leonel
leonel

Reputation: 10224

Rails cap:deploy How to fix error "Compiling V8 cp -r scons build make: ruby: Command not found"?

I get this error when running cap:deploy

I already run apt-get update and apt-get upgrade

I already ran bundle install, added Gemfile and Gemfile.lock to the repository.

  * executing "cd /var/www/releases/20120606045148 && bundle install --gemfile /var/www/releases/20120606045148/Gemfile --path /var/www/shared/bundle --deployment --quiet --without development test"
    servers: ["11.111.11.11"]
    [11.111.11.11] executing command
 ** [out :: 11.111.11.11] Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
 ** [out :: 11.111.11.11] 
 ** [out :: 11.111.11.11] /usr/bin/ruby1.9.1 extconf.rb
 ** [out :: 11.111.11.11] Compiling V8
 ** [out :: 11.111.11.11] cp -r scons build
 ** [out :: 11.111.11.11] make: ruby: Command not found
 ** [out :: 11.111.11.11] make: ruby: Command not found
 ** [out :: 11.111.11.11] cd build/v8 && GCC_VERSION= ../scons/install/bin/scons arch=
 ** [out :: 11.111.11.11] scons: Reading SConscript files ...
 ** [out :: 11.111.11.11] Unknown arch value ''.  Possible values are (arm, ia32, x64, mips).
 ** [out :: 11.111.11.11] make: *** [build/v8/libv8.a] Error 1
 ** [out :: 11.111.11.11] *** extconf.rb failed ***
 ** [out :: 11.111.11.11] Could not create Makefile due to some reason, probably lack of
 ** [out :: 11.111.11.11] necessary libraries and/or headers.  Check the mkmf.log file for more
 ** [out :: 11.111.11.11] details.  You may need configuration options.
 ** [out :: 11.111.11.11] 
 ** [out :: 11.111.11.11] Provided configuration options:
 ** [out :: 11.111.11.11] --with-opt-dir
 ** [out :: 11.111.11.11] --without-opt-dir
 ** [out :: 11.111.11.11] --with-opt-include
 ** [out :: 11.111.11.11] --without-opt-include=${opt-dir}/include
 ** [out :: 11.111.11.11] --with-opt-lib
 ** [out :: 11.111.11.11] --without-opt-lib=${opt-dir}/lib
 ** [out :: 11.111.11.11] --with-make-prog
 ** [out :: 11.111.11.11] --without-make-prog
 ** [out :: 11.111.11.11] --srcdir=.
 ** [out :: 11.111.11.11] --curdir
 ** [out :: 11.111.11.11] --ruby=/usr/bin/ruby1.9.1
 ** [out :: 11.111.11.11] extconf.rb:10:in `<main>': Error compiling V8 (RuntimeError)
 ** [out :: 11.111.11.11] 
 ** [out :: 11.111.11.11] 
 ** [out :: 11.111.11.11] Gem files will remain installed in /var/www/shared/bundle/ruby/1.9.1/gems/therubyracer-0.8.2 for inspection.
 ** [out :: 11.111.11.11] Results logged to /var/www/shared/bundle/ruby/1.9.1/gems/therubyracer-0.8.2/ext/v8/gem_make.out
 ** [out :: 11.111.11.11] An error occured while installing therubyracer (0.8.2), and Bundler cannot continue.
 ** [out :: 11.111.11.11] Make sure that `gem install therubyracer -v '0.8.2'` succeeds before bundling.
    command finished in 73622ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /var/www/releases/20120606045148; true"
    servers: ["11.111.11.11"]
    [11.111.11.11] executing command
    command finished in 7100ms
failed: "env PATH=/var/lib/gems/1.9.1/bin:$PATH sh -c 'cd /var/www/releases/20120606045148 && bundle install --gemfile /var/www/releases/20120606045148/Gemfile --path /var/www/shared/bundle --deployment --quiet --without development test'" on 11.111.11.11

Upvotes: 0

Views: 293

Answers (2)

Harry
Harry

Reputation: 4835

I would recommend installing rvm here - as Joshua Cheek said, the problem appears to be with the ruby binary, which should be helped by rvm.

Do apt-get install rvm, then once it is installed run rvm list known to give you a list of the available ruby versions; install the one you want with rvm install (version) then rvm use (version) (exclude brackets).

Doing this will ensure you have a clean install of ruby, with available ruby command and a clean gemset.

You should then be able to do apt-get install libv8 - if you are still having a problem, do an edit with the error message and we'll go from there.

Upvotes: 2

Joshua Cheek
Joshua Cheek

Reputation: 31756

It looks like your ruby binary is named ruby1.9.1, but it is trying to invoke the binary ruby. you could probably put a symlink named 'ruby' somewhere in your path, and have it point to /usr/bin/ruby1.9.1.

Upvotes: 1

Related Questions