Wednesday, October 27, 2021

[SOLVED] Why do I get failed: "sh -c 'cd /var/www/releases...'" when deploying a Rails app?

Issue

I'm deploying to a Debian 6 server, with Apache, Passenger, Ruby1.9.1

When I run "cap deploy" or "cap deploy:migrations" I get this error:

[out :: ip.address] Could not find multi_json-1.0.3 in any of the sources
 ** [out :: ip.address] Run `bundle install` to install missing gems.
 ** [out :: ip.address] 
    command finished in 1037ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /var/www/releases/20111208004427; true"
    servers: ["ip.address"]
    [ip.address] executing command
    command finished in 489ms
failed: "sh -c 'cd /var/www/releases/20111208004427 && /usr/bin/rake1.9.1 RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'" on ip.address

Note the run bundle install to install missing gems and failed sh -c ... part.

I already tried this export PATH=/var/lib/gems/1.9.1/bin:${PATH} and tried many other possible solutions but nothing seems to work.

By the way, NO rvm.


Solution

For reference for everybody else getting the same error. Found answer: http://www.pastbedti.me/2011/06/change-path-environment-with-rails-and-capistrano/



Answered By - leonel