So I'm using Bitnami to learn Ruby on Rails. I have also previously tried the manual installation for ruby and rails and was met by the same problem so I thought I should try first the easy package deal of Bitnami. Anyway my problem with json is that it causes the bundle install to fail.
First the auto bundle install that rails new does fails because of an ssl error. Which is easily solved by changing the source in the gemfile which is https to http.
However when I try to bundle install it does another error when it tries to install json.
C:\RubyStack-3.2.7-0\projects\testing>bundle install
Fetching gem metadata from http://rubygems.org/.........
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.3.6)
Installing activesupport (3.2.8)
Using builder (3.0.0)
Installing 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)
Installing actionpack (3.2.8)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.4)
Installing actionmailer (3.2.8)
Using arel (3.0.2)
Using tzinfo (0.3.33)
Installing activerecord (3.2.8)
Installing 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:/RUBYST~1.7-0/ruby/bin/ruby.exe extconf.rb
creating Makefile
make
0 [main] echo 5244 open_stackdumpfile: Dumping stack trace to echo.exe.sta
ckdump
make: *** [generator-i386-mingw32.def] Error 5
Gem files will remain installed in C:/RUBYST~1.7-0/ruby/lib/ruby/gems/1.9.1/gems
/json-1.7.5 for inspection.
Results logged to C:/RUBYST~1.7-0/ruby/lib/ruby/gems/1.9.1/gems/json-1.7.5/ext/j
son/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.
This is the gem_make.out file it produces after trying to install json (btw windows also produces an error that echo.exe has stopped working while running the gem install json)
C:/RUBYST~1.7-0/ruby/bin/ruby.exe extconf.rb
creating Makefile
make
0 [main] echo 5244 open_stackdumpfile: Dumping stack trace to echo.exe.stackdump
make: *** [generator-i386-mingw32.def] Error 5
I can't even start learning ror for the setup is already a huge pain. (btw I have no prior experience with web frameworks, just desktop programming). help?
Have you considered dropping bitnami, starting fresh, and going through Michael Hartl's http://ruby.railstutorial.org/ruby-on-rails-tutorial-book?
It will get you set up from the beginning and the price is right (free).
Building native extensions. This could take a while.
`ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/Users/bruceyue001/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb`
Creating makefile
make
compiling generator.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [generator.o] Error 1
Gem files will remain installed in /Users/bruceyue001/.rvm/gems/ruby-1.9.3-p194/gems/json-1.7.5 for inspection.
Results logged to /Users/bruceyue001/.rvm/gems/ruby-1.9.3-p194/gems/json-1.7.5/ext/json/ext/generator/gem_make.out
Running rails on windows requires the installation of DevKit.
Install the DevKit and it should fix your problem:
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
Related
I'm using the eb CLI to install my rails app on AWS. I've gotten a test one to work before, but now I'm trying to deploy some actual code that I wrote. When I do git aws.push, the update fails. "eb logs" command shows that the bundler failed.
I am running this on 64bit Amazon Linux 2014.03 v1.0.0 running Ruby 2.1 (Puma)
Fetching source index from https://rubygems.org/
Using rake (10.3.2)
Using i18n (0.6.11)
Using minitest (4.7.5)
Using multi_json (1.10.1)
Using thread_safe (0.3.4)
Using tzinfo (0.3.41)
Using activesupport (4.0.8)
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.8)
Using mime-types (1.25.1)
Using polyglot (0.3.5)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.8)
Using activemodel (4.0.8)
Using active_model_serializers (0.9.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.2)
Using activerecord (4.0.8)
Using addressable (2.3.6)
Using execjs (2.2.1)
Using autoprefixer-rails (3.0.1.20140826)
Installing bcrypt (3.1.7)
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/opt/rubies/ruby-2.1.2/bin/ruby extconf.rb
Cannot allocate memory - /opt/rubies/ruby-2.1.2/bin/ruby extconf.rb 2>&1
Gem files will remain installed in /opt/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/bcrypt-3.1.7 for inspection.
Results logged to /opt/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0-static/bcrypt-3.1.7/gem_make.out
An error occurred while installing bcrypt (3.1.7), and Bundler cannot continue.
Make sure that `gem install bcrypt -v '3.1.7'` succeeds before bundling.
2014-09-03 00:22:36,561 [ERROR] (3331 MainThread) [directoryHooksExecutor.py-33] [root directoryHooksExecutor error] Script /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed with returncode 5
I'm not calling bcrypt in my gem file either. It must be a dependency of the sorcery gem.
I've attempted to use the "bundle package" for the vendor/cache trick, but it kept saying some gems were missing on AWS. As you can tell, I'm fairly new to not only elastic beanstalk/aws but to rails as well, so I could just be doing something totally wrong.
Also, when I remove bcrypt references (which I'm sure will break something) in the gemfile.lock, it just throws the same error on a different gem later on (ffi). I'm sure there are many gems that it will eventually throw the error on if I just manage to fix the issue one gem at a time.
The error is actually caused by instance running out of memory while running make:
Cannot allocate memory - /opt/rubies/ruby-2.1.2/bin/ruby extconf.rb 2>&1
More than likely you are running a micro instance--bump it up to a larger instance size and it should build reliably.
Rohit is right though in his answer that missing system packages are often a cause of gems failing to install in Elastic Beanstalk.
So there may be some dependencies on C libraries that are required for gem install bcrypt -v '3.1.7'. You can install native dependencies using yum and ebextensions.
You can use ebextensions to install yum packages required for gem install to succeed. Create a file called .ebextensions/01-yum.config in your app source and put the following contents in it.
packages:
yum:
<required-native-dependency>: []
This file is in YAML format so indentation is important.
Read more about pacakges section of ebextensions here:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#customize-containers-format-packages
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.
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.
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.