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.
Related
Mac OSX Mountain Lion, Rails 4.0.0, Ruby 1.9.3, Postgresql
I am working on a project with one of my friends and when I cloned into his master code (using "git clone") and tried running "bundle install" I received the following message:
unknown00231254a715:grablink shaunbarnes$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.1)
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.0)
Using activerecord (4.0.0)
Using addressable (2.3.5)
Using bcrypt-ruby (3.1.2)
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.0)
Using commonjs (0.2.6)
Using orm_adapter (0.4.0)
Using warden (1.2.3)
Using devise (3.1.1)
Using rest-client (1.6.7)
Using dwolla-ruby (2.5.0)
Using bundler (1.3.5)
Using hike (1.2.3)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using filepicker-rails (1.0.0) from git://github.com/Ink/filepicker-rails.git (at master)
Using jbuilder (1.5.2)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Using less (2.3.2)
Using less-rails (2.3.3)
Using libv8 (3.11.8.17)
Installing ox (2.0.11)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb
>>>>> Creating Makefile for ruby version 1.9.3 on x86_64-darwin10.8.0 <<<<<
creating Makefile
make
compiling base64.c
compiling cache.c
compiling cache8.c
compiling cache8_test.c
compiling cache_test.c
compiling dump.c
compiling err.c
compiling gen_load.c
compiling obj_load.c
compiling ox.c
compiling parse.c
compiling sax.c
sax.c:90: error: expected declaration specifiers or ‘...’ before numeric constant
sax.c:90: error: expected ‘)’ before ‘!=’ token
sax.c:90: error: expected ‘)’ before ‘?’ token
make: *** [sax.o] Error 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p392/gems/ox-2.0.11 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p392/gems/ox-2.0.11/ext/ox/gem_make.out
An error occurred while installing ox (2.0.11), and Bundler cannot continue.
Make sure that `gem install ox -v '2.0.11'` succeeds before bundling.
And I received the exact same ERROR message after installing Postgresql locally and creating a new path as suggested in a similar StackOverflow question:
PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
I have also tried to install the gem manually "gem install ox -v 2.0.11", but that also ends with the same message.
Any ideas in regards to why this is happening?
Thanks!
Problem solved! Thanks Pippin!
I installed a different version of ruby using rvm -- if you don't have it here is a link to the site https://rvm.io/ or to download you can use the following command in your terminal: "$\curl -L https://get.rvm.io | bash"
Following are the commands I used to load the new ruby version:
rvm get head
brew install autoconf automake
rvm reload
rvm use ruby-1.9.3-p327-fast --default
Then rerun "bundle install".
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.
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.
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 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