Can't run bundle update because of json 1.7.5 - ruby-on-rails

I can't seem to run bundle update on my Windows 7 machine with Ruby 1.9.3p194. I've installed the latest DevKit as well. bundle complains about the lack of a make command, I can't find make on my hard drive (I searched). How do I get this to work?
C:\website>bundle update
Fetching gem metadata from http://rubygems.org/.........
Using rake (0.9.2.2)
Using i18n (0.6.1)
Using multi_json (1.3.6)
Using activesupport (3.2.8)
Using builder (3.0.2)
Using activemodel (3.2.8)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.3)
Using actionpack (3.2.8)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.4)
Using actionmailer (3.2.8)
Using arel (3.0.2)
Using tzinfo (0.3.33)
Using activerecord (3.2.8)
Using activeresource (3.2.8)
Using bundler (1.1.5)
Using coffee-script-source (1.3.3)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Installing json (1.7.5) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile
make
'make' is not recognized as an internal or external command,
operable program or batch file.
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.7.5 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.7.5/ext/json/ext/generator/gem_make.out
An error occured while installing json (1.7.5), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.5'` succeeds before bundling.

ruby dk.rb install --force in the DevKit directory did the trick.

Some gems require compilation, which is the case of json gem.
You can solve compilation issues for most gems by installing RubyInstaller's DevKit, available from the downloads page
Once downloaded, please follow the installation instructions from RubyInstaller wiki page.
After installation, open a new command prompt and try installing the offending gem again:
gem install json
It should succeed.
That is considering DevKit was properly installed. As discussed on the RubyInstaller mailing list, you can force DevKit installation:
ruby dk.rb install --force
In the DevKit directory.

Related

Gem Installer Extension Build error

I'm trying to update gem file from a freshly created Rails app. Each time I get the following:
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.2)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.38)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.1)
Using activerecord (4.0.0)
Using bundler (1.3.5)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.1)
Using hike (1.2.3)
Using jbuilder (1.5.2)
Using jquery-rails (3.0.4)
Installing json (1.8.1)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/adrianleeelder/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb
creating Makefile
make
compiling generator.c
make: gcc-4.2: No such file or directory
make: *** [generator.o] Error 1
Gem files will remain installed in /Users/adrianleeelder/.rvm/gems/ruby-2.0.0-p0/gems/json-1.8.1 for inspection.
Results logged to /Users/adrianleeelder/.rvm/gems/ruby-2.0.0-p0/gems/json-1.8.1/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.
I updated to OS X Mavericks a while back and ever since I have had this problem. A lot of users are suggesting to run the command: xcode-select --install.
I fixed the error by doing the following:
1) Run the command which gcc
2) Then based on the output adjust this command and run it: ln -s /usr/bin/gcc /usr/bin/gcc-4.2 (May have to prepend sudo if permission is denied)
The bundle command should compile the gems correctly now.
Installing Xcode will also work. I had already installed Xcode, but for some reason when I tried to launch it recently it prompted an install. Using Alfred (the quick launch application) I typed Xcode and launched the installer.
I fixed the error through homebrew using the following:
brew tap homebrew/versions && brew install apple-gcc42
brew link --force apple-gcc42
ln -nsf $(which gcc-4.2) /usr/bin/gcc-4.2
You may have to 'sudo' for the last command if you get permission issues.

Gem installer error when setting up ruby on rails (Windows 7)

I'm getting an error trying to set up a Ruby on Rails site. I've never used Ruby before, so everything is clean out of the installer.
I've installed Ruby 1.9.3 and RubyGems 2.0.3. I then installed rails using gem and created a blank site with rails new. At some point I also installed the DevKit as instructed here - I can't remember when exactly, but I was explicitly asked to at some point. I then tried to start it using rails server, but it's asking me to use bundle install to install some missing gems. Easy enough, but when I try that I get the following output:
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.0.4)
Using i18n (0.6.1)
Using multi_json (1.7.3)
Using activesupport (3.2.13)
Using builder (3.0.4)
Using activemodel (3.2.13)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.5)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.2)
Using tilt (1.4.1)
Using sprockets (2.2.2)
Using actionpack (3.2.13)
Using mime-types (1.23)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.5.3)
Using actionmailer (3.2.13)
Using arel (3.0.2)
Using tzinfo (0.3.37)
Using activerecord (3.2.13)
Using activeresource (3.2.13)
Using bundler (1.3.5)
Using coffee-script-source (1.6.2)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.3)
Installing json (1.7.7)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
"C:/Ruby/Ruby 1.9.3/bin/ruby.exe" extconf.rb
C:/Ruby/Ruby 1.9.3/bin/ruby.exe: invalid option -1 (-h will show valid options) (RuntimeError)
Gem files will remain installed in C:/Ruby/Ruby 1.9.3/lib/ruby/gems/1.9.1/gems/json-1.7.7 for inspection.
Results logged to C:/Ruby/Ruby 1.9.3/lib/ruby/gems/1.9.1/gems/json-1.7.7/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.7'` succeeds before bundling.
I get the same error when running either gem install json -v '1.7.7' or just gem install json. This particular error has proved itself resistant to Googling, so I thought I'd try asking here. Any help would be appreciated!
Well, it turns out the problem was that the path to my Ruby install has spaces in it. This is apparently strongly disrecommended in a number of places, but the error message was unrelated enough that it took me a while to put two and two together.

I exited out of terminal, re-opened, now every time I run rspec I get this error, what gives?

Seriously have no idea what has happened any help would be great thanks.
GacntMac in ~/Desktop/rails_projects/sample_app on updating-users
+ bundle install (Tue, Feb 05)
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Using rake (10.0.3)
Using i18n (0.6.1)
Using multi_json (1.5.0)
Using activesupport (3.2.11)
Using builder (3.0.4)
Using activemodel (3.2.11)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.4)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.2.2)
Using actionpack (3.2.11)
Using mime-types (1.20.1)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.4.4)
Using actionmailer (3.2.11)
Using arel (3.0.2)
Using tzinfo (0.3.35)
Using activerecord (3.2.11)
Using activeresource (3.2.11)
Installing bcrypt-ruby (3.0.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Users/GacntMac/.bundler/tmp/2663/gems/bcrypt-ruby-3.0.1 for inspection.
Results logged to /Users/GacntMac/.bundler/tmp/2663/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out
An error occurred while installing bcrypt-ruby (3.0.1), and Bundler cannot continue.
Make sure that `gem install bcrypt-ruby -v '3.0.1'` succeeds before bundling.
GacntMac in ~/Desktop/rails_projects/sample_app on updating-users
I cd'd to the directory the error says ruby.h should be in, but I don't see anything..
GacntMac in /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby
o ls -a (Tue, Feb 05)
. .. 1.8 gems site_ruby user-gems vendor_ruby
Edit: Added rvm info
GacntMac in /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby
o rvm info (Tue, Feb 05)
-bash: rvm: command not found
This is weird cause I've been playing with Rails for days, now it some how uninstalled its self?
This only started happening since I exited out of terminal and re-opened it. I'm lost and new to Rails so I have no idea what any of this means, just trying to follow a tutorial. Thanks!
You are trying to install software into the system installation of Ruby, put there by Apple.
RVM or rbenv will install things into a private sandbox in your home directory. The error shows the file isn't going there, so your RVM or rbenv isn't initialized correctly.
If you run RVM, execute rvm info from the command-line, and look at the information output, as a sanity check.

bcrypt-ruby failed to build gem native extension

I'm new to RoR and hit a snag with installing the bcrypt-ruby (v 3.0.1) gem (from gemfile) when following RailsTutorial.org. In looking through other responses on the site, what's not clear to me is if this a is version incompatibility issue, a missing ruby-dev environment, something to do with Xcode, an extra space in the "ruby extconf.rb" or something else. Any suggestions would be greatly appreciated. Thanks.
My environment = OS X v 10.8, Ruby 1.9.3p194 and Rails 3.2.6.
tj$ bundle install
Fetching gem metadata from https://rubygems.org/........
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.3.6)
Using activesupport (3.2.6)
Using builder (3.0.0)
Using activemodel (3.2.6)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.3)
Using actionpack (3.2.6)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.4)
Using actionmailer (3.2.6)
Using arel (3.0.2)
Using tzinfo (0.3.33)
Using activerecord (3.2.6)
Using activeresource (3.2.6)
Using addressable (2.3.1)
Using annotate (2.5.0)
Installing bcrypt-ruby (3.0.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/tj/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
creating Makefile
make
sh: make: command not found
Gem files will remain installed in /Users/tj/.rvm/gems/ruby-1.9.3- p194#rails3tutorial2ndEd/gems/bcrypt-ruby-3.0.1 for inspection.
Results logged to /Users/tj/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/bcrypt- ruby-3.0.1/ext/mri/gem_make.out
An error occured while installing bcrypt-ruby (3.0.1), and Bundler cannot continue.
Make sure that `gem install bcrypt-ruby -v '3.0.1'` succeeds before bundling.
It looks to me like you don't have make on your system. If you're using a Mac, you need to install the Xcode command line tools.

I'm having trouble installing missing gems in Rails

I'm having problems starting my Rails web server. I try to enter "rails server" in the cmd prompt but I get the following error:
C:\Ruby193\demo>rails server
←[31mCould not find gem 'jquery-rails (>= 0) x86-mingw32' in the gems available
on this machine.←[0m
←[33mRun `bundle install` to install missing gems.←[0m
but whenever I then do a bundle install to install the missing gem, I get this error:
C:\Ruby193\demo>bundle install
Fetching gem metadata from https://rubygems.org/.........
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.2.0)
Using activesupport (3.2.3)
Using builder (3.0.0)
Using activemodel (3.2.3)
Using erubis (2.7.0)
Using journey (1.0.3)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.2)
Using actionpack (3.2.3)
Using mime-types (1.18)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.4)
Using actionmailer (3.2.3)
Using arel (3.0.2)
Using tzinfo (0.3.33)
Using activerecord (3.2.3)
Using activeresource (3.2.3)
Using bundler (1.1.3)
Using coffee-script-source (1.3.1)
Using execjs (1.3.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Installing json (1.6.6) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extensio
.
C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile
make
'make' is not recognized as an internal or external command,
operable program or batch file.
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.6
6 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.6.6/ext/json/ext/g
nerator/gem_make.out
An error occured while installing json (1.6.6), and Bundler cannot continue.
Make sure that `gem install json -v '1.6.6'` succeeds before bundling.
I then tried to install json without any luck. Any suggestions?
Since you're on Windows, you need to install the Development Kit to be able to build gems with native extensions.
https://github.com/oneclick/rubyinstaller/wiki/development-kit

Resources