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
Related
I have the rather unfortunate position of inheriting a rails app from a previous developer. I have the joy of both trying to learn ruby and picking apart the old code to fix what's broken. I don't have any means for contacting the former developer, nor do I have much knowledge of the app other than that it uses ruby on rails. I'm much more familiar with the .net environment, so getting RoR up and running is proving to be a bit of a challenge.
I'm simply trying to clone their code repo locally and try to run their code on a local rails server. I was able to clone, the next thing I tried was to run bundle install and I got this massive block of text that I can't make heads or tails of.
Massive wall of text below
Justin#JVB-MBP /c/Sites/mymouthworks (master)
$ bundle install
DL is deprecated, please use Fiddle
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Using rake 10.1.1
Using i18n 0.6.9
Using minitest 4.7.5
Using multi_json 1.8.4
Using atomic 1.1.14
Using thread_safe 0.1.3
Using tzinfo 0.3.38
Using activesupport 4.0.2
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.2
Using mime-types 1.25.1
Using polyglot 0.3.4
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.0.2
Using activemodel 4.0.2
Using activerecord-deprecated_finders 1.0.3
Using arel 4.0.2
Using activerecord 4.0.2
Using bcrypt-ruby 3.1.2
Using sass 3.2.14
Using bootstrap-sass 3.1.1.1
Using will_paginate 3.0.4
Using bootstrap-will_paginate 0.0.9
Using bundler 1.7.7
Using chunky_png 1.3.0
Using coffee-script-source 1.7.0
Using execjs 2.0.2
Using coffee-script 2.2.0
Using thor 0.18.1
Using railties 4.0.2
Using coffee-rails 4.0.1
Using commonjs 0.2.7
Using fssm 0.2.10
Using compass 0.12.3
Using hike 1.2.3
Using tilt 1.4.1
Using sprockets 2.11.0
Using compass-rails 1.1.7
Using date_validator 0.7.0
Using jbuilder 1.5.3
Using jquery-rails 3.1.0
Using json 1.8.1
Using less 2.4.0
Using less-rails 2.4.2
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
c:/RailsInstaller/Ruby2.1.0/bin/ruby.exe -r ./siteconf20150212-3448-1yjlu6v.
rb extconf.rb
creating Makefile
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8 3.16.14.3/ext/libv8/builder.rb:58:in `setup_python!': libv8 requires python 2 to be installed in order to build, but it is currently not available (RuntimeError)
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.3/ext/libv8/builder.rb:42:in `block in build_libv8!'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.3/ext/libv8/builder.rb:40:in `chdir'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.3/ext/libv8/builder.rb:40:in `build_libv8!'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.3/ext/libv8/location.rb:24:in `install!'
from extconf.rb:7:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.3 for inspection.
Results logged to c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/libv8-3.16.14.3/gem_make.out
An error occurred while installing libv8 (3.16.14.3), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.16.14.3'` succeeds before bundling.
Justin#JVB-MBP /c/Sites/mymouthworks (master)
$
To me, it looks like there's an issue with libv8, but there is also a warning about python 2 not being installed, which it is, along with being added to the path variable. I should add my dev environment is 64-bit Windows 8.1. Has anyone got this working?
Thank you.
You are correct that libv8 did not successfully install.
Bundler will not continue until that step succeeds. You need to run:
gem install libv8 -v '3.16.14.3'
A nice feature about Bundler is that it gives you the command you need to run in order to proceed. If this command fails you should get a better error message to work with.
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.
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.
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
Using Snow leopard, Rails 3.0.3, ruby 1.9.2p0 and RVM. When trying to install bundle I get:
[first_app]$ bundle install
Fetching source index for http://rubygems.org/
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.7)
Using tzinfo (0.3.24)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.14)
Using actionmailer (3.0.3)
Using arel (2.0.7)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bundler (1.0.7)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Installing sqlite3 (1.3.3) with native extensions /Users/dawson/.rvm/rubies/ruby-1.9.2-p
0/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/dawson/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb
checking for sqlite3.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
You are missing some libraries on your system related to sqlite. This is a common problem with gems that depend on libraries which should be installed on your computer. try installing libsqlite3-dev.
I ran into almost exactly this problem (Snow Leopard, Ruby1.9.2-p0, RVM, Rails 3.1.0rc4, with developer tools installed), and resolved it by upgrading to a newer patch level of Ruby.
Using RVM, you'd write:
rvm upgrade ruby-1.9.2-p180 ruby-1.9.2-p0
(180 is the current patch, but there might be a newer one when you try this. Use the stable release version named here: http://www.ruby-lang.org/en/downloads/)
Try:
gem "sqlite-ruby", "~> 1.3.1"
You may be having issues because you're on Ruby 1.9. This gem is said to work with 1.9:
http://isitruby19.com/sqlite3-ruby
Use 'sudo bundle install' since native extensions try to write in system directories.
sudo -s
export ARCHFLAGS='-arch x86_64'
export PATH=/Library/PostgreSQL/9.1/bin:${PATH}
gem install pg