简体   繁体   中英

rvm and GEM_PATH after Capistrano deployment; can't access “rails c”

I am using Capistrano to deploy to a Ubuntu 11.10 host using rvm and ruby 1.9.2-p290. This appears to be working fine.

Passenger / nginx is set up correctly and it is serving up rails pages fine. The issue is that I have gems now in a couple of places.

Gem environment gives me:

GEM PATHS:     "/usr/local/rvm/gems/ruby-1.9.2-p290:/usr/local/rvm/gems/ruby-1.9.2-p290@global

but rails is installed in $appname/shared/bundle/ruby/1.9.1/gems . I'd like to run rails c but can't. How would I fix this?

edit #1 This is hosted at Linode

if you used:

bundle install --path <path>

then you need to run the gems with:

bundle exec rails c

you could also use:

bundle install --path <path> --binstubs

and change PATH :

PATH=$appname/bin:$PATH

or use the bundler hook in rvm:

chmode +x $rvm_path/hooks/after_cd_bundler

which will update the path when you:

cd $appname

I was originally running:

bundle exec rails c

but, was getting permission issues, so you must provide the env:

RAILS_ENV=production bundle exec rails c

or better yet:

bundle exec rails c production

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM