I'm using Ruby on rails (RubyMine) and I try starting my project.
Which tells me the error "Could not find gem 'mysql2 (~> 0.2.6, runtime)' in any of the gem sources listed in your Gemfile. (Bundler::GemNotFound)".
I've done sudo gem install mysql which gives me
"Error installing mysql:
ERROR: Failed to build gem native extension.
Gem files will remain installed in /var/lib/gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /var/lib/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
"
What should I do?
You're probably missing the development headers for MySQL. Often this is shipped as an optional package to install. You may need to install mysql-dev or mysql-devel depending on your package manager.
You might also be missing a compiler, so check that you have the required dependencies for gem such as make and gcc.
You might be missing the Ruby development headers as well. On my Ubuntu 11.04 box I have the following aptitude package which is needed for native gem compilation:
ruby1.9.1-dev
Related
I am newbie to ruby on rails, here i am trying to install ruby on rails on windows 7 64 bit. i installed the ruby installer and i installed rails. and also i created new app files. but when i start the rails server it is showing the following errors.
How can i get rid of these errors and start developing my ruby application?
C:\Users\walnut\Desktop > bundle install
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies.................
Using rake 10.4.2
Using i18n 0.7.0
Installing json 1.8.3 with native extensions
Gem::InstallError: The 'json' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.3'` succeeds before bundling.
C:\Users\walnut\Desktop > rails s
Could not find gem 'mysql2 (>= 0) x64-mingw32' in any of the gem sources listed
in your Gemfile or available on this machine.
Run `bundle install` to install missing gems.
C:\Users\walnut\Desktop > gem install mysql2
Fetching: mysql2-0.3.19.gem (100%)
ERROR: Error installing mysql2:
The 'mysql2' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
C:\Users\walnut\Desktop > rails s
Could not find gem 'mysql2 (>= 0) x64-mingw32' in any of the gem sources listed
in your Gemfile or available on this machine.
Run `bundle install` to install missing gems.
From here,
Follow the Instructions from the Ruby Installer Developer Kit Wiki:
Download DevKit file from rubyinstaller.org
Extract DevKit to path C:\RubyXXX\DevKit
Run cd C:\RubyXXX\DevKit
Run ruby dk.rb init
Run ruby dk.rb review
Run ruby dk.rb install
Where did you create your application? If you look at your command line, you are in your Desktop. You need to switch directories to your project folder to be in the right context.
Additionally, you need to install build tools to install json native extensions.
Please refer to/follow instructions from this other stack overflow answer - The 'json' native gem requires installed build tools.
As the error suggest you have to update your PATH to include build tools also known as DevKit.
If you have used RailsInstaller to install ruby on rails on your computer then it has already included in your rails installation directory. All you have to do now is to update your PATH to include it. See step 4 of instruction in DevKit Overview on Github.
If not follow above instruction to install DevKit and then get to work.
Try follow this step and one more thing, if you use x64 of ruby installer, then please use x64 devkit. Same applied to x86. I'm facing this issues and the link gave it(step to install) to you save my time. Hope this helped.
p/s : if i'm correct in windows, ruby v2.2 above was't support higher nokogiri, to get things working properly use either ruby v1.9.3 or v2.1.6.
Check this link also for nokogiri supported.
I am trying host OpenSourceBilling application built using Ruby on Rails framework to OpenBSD server. When i try to install gems using bundle install command, I get following error on therubyracer gem installation:
/usr/local/lib/ruby/gems/2.0/gems/libv8-3.16.14.7/ext/libv8/location.rb:50:in `configure': You have chosen to use the version of V8 found on your system (Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem.
However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.7 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location
Any help in this regard will be appreciated.
update libv8 to point to version ~> 3.11.8.3 in your gemfile
this will work.....
I was unable to install therubyracer gem in OpenBSD. As a workaround, I replaced it with the nodejs javascript runtime:
gem 'node'
Make sure to remove the gem 'therubyracer' line.
I was able to install the rmagick-2.6.0-x86-mswin32.gem gem in my windows 7 machine using gem install command and I got the following success messages:
D:\dev>gem install rmagick-2.6.0
Successfully installed rmagick-2.6.0-x86-mswin32
1 gem installed
Installing ri documentation for rmagick-2.6.0-x86-mswin32...
Installing RDoc documentation for rmagick-2.6.0-x86-mswin32...
But when I try to install using bundle install (with the same version mentioned in the Gemfile) it throws the following error messages:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
. D:/Ruby187/bin/ruby.exe extconf.rb
checking for Ruby version >= 1.8.2... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 2.6.0. Can't find Magick-config in D:\Ruby187\bin;D:\Ruby1
....
I already have ImageMagick installed and its paths included in the env vars, but the paths mentioned in the error message above seem to be different somehow(?!)
When i type rails -v now, I get the following message:
D:\dev>rails -v
←[31mCould not find gem 'rmagick (= 2.6.0) x86-mingw32' in the gems available on
this machine.←[0m
←[33mRun `bundle install` to install missing gems.←[0m
Do i need to make any other changes/ setups to install this gem with my gemfile using bundle install?
Also I actually need an earlier gem '2.5.2' but the win32 specific version of that gem does not seem to available, is there any way to get it?
I need to do this development on windows for the moment so I can switch to any other OS for the moment. Also since this is a legacy app I am working on, I will need to stick with rmagick and can't switch to any other solution.
Env info:
Ruby: 1.8.7
Rails:
Please help!
Many thanks.
Hey have you tried installing Devkit, for installing gems with native extensions on windows.
Try the steps in the following link, and check whether the Devkit has been installed in your path variable, try opening a new command shell and install the gems.
http://doelsengupta.blogspot.in/2010/10/unable-to-download-gem-with-native.html
all the best!!
I kept having this problem but was finally able to get around it using the following solution from #Martin Cohen - after modifying the gemspec file as he has suggested and rebuilding it, i was able to successfully install rmagick gem using bundle install...
https://stackoverflow.com/a/5595274/1865578
cheers!
I am new to ruby on rails, I am trying to get my first project working with git and heroku. I am following the tutorial by Michael Hartl. I was originally trying to
git push heroku master
but I dont have a GemFile.lock, so I have been trying bundle installs and bundle updates but nothing works because I dont have the json native gem.
bundle update
this is the command that reuturned this error, its not the whole error i left out all the gems i already have
Installing json (1.7.3) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
"C:/Program Files/ruby-1.9.3/bin/ruby.exe" extconf.rb
creating Makefile
make
Makefile:160: warning: overriding commands for target `C:/Program'
Makefile:153: warning: ignoring old commands for target `C:/Program'
C:/Program Files/ruby-1.9.3/bin/ruby -e "puts 'EXPORTS', 'Init_parser'" > parser-i386
mingw32.def
/bin/sh: C:/Program: No such file or directory
make: *** [parser-i386-mingw32.def] Error 127
Gem files will remain installed in C:/Program Files/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/json-1.7.3 f
or inspection.
Results logged to C:/Program Files/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/json-1.7.3/ext/json/ext/parser/gem_make.out
An error occured while installing json (1.7.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.3'` succeeds before bundling.
If anybody knows how to fix my error so that i can move onto the next one or how i can get a working GemFile.lock, it would be appreciated.
Install json_pure instead on your development machine. This is a version of the json gem that does not require C-extensions (but is a bit slower).
On Heroku you should be able to go with the faster json directly.
If you want to build the C-extension on windows then you might want to look here:
The 'json' native gem requires installed build tools
You can create a windows-specific section in the Gemfile like so:
# Common gems
gem 'xyz'
...
# Platform specific gems
platforms :ruby do
gem 'json'
end
platforms :mswin, :mingw do
gem 'json_pure'
end
Windows isn't properly escaping the space in "C:\Program Files". I haven't used Windows in a while, but a quick search reveals a few fixes.
I had the same problem and found that in my config.yaml file, there was an installation of Ruby 1.9.2 that had a space in it. I had to uninstall that version of Ruby entirely, and remove it from the PATH in environment variables. Then, I re-installed the DevKit and it worked perfectly.
As shown in a blog I followed the instructions of setting up SQLite3 on my Windows, but after I pasted the necessary files in Bin folder of Ruby, which I downloaded from http://www.sqlite.org/download.html, I get the following error when I use the following commmands:
C:\gem install sqlite3-ruby --version=1.2.3
ERROR: http://rubygems.org does not appear to be a repository
ERROR: Could not find a valid gem 'sqlite3-ruby' (= 1.2.3) in any repository
Please help me out with this problem and suggest me alternate methods for gem installing SQLite3.
Thanks.
Check that you have the latest version of rubygems: gem -v executed in a command prompt should return 1.3.7. If it does not, you have several options (also explained on rubygems.org):
gem update --system
or
gem install rubygems-update
update_rubygems
Secondly, if you have the correct version and you are on a network with a proxy, you have to tell gem to use that proxy.
There are two ways to do that. First, you could do
gem install sqlite3-ruby -p http://yourproxyserver:port`
or you could define an environment variable
set HTTP_PROXY=http://yourproxyserver:port
and then this setting is saved (and you do not have to specify it explicitly anymore).
Hope this helps.
Try doing this: gem install sqlite3-ruby --version=1.2.3 --source http://gemcutter.org
If that does not work head over to http://gemcutter.org and download the particular version of the gem file, go to the destination to where you copied it to in the command line and install it locally using gem install sqlite3-ruby -l