简体   繁体   English

Capistrano部署后的rvm和GEM_PATH; 无法访问“rails c”

[英]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. 我正在使用Capistrano使用rvm和ruby 1.9.2-p290部署到Ubuntu 11.10主机。 This appears to be working fine. 这似乎工作正常。

Passenger / nginx is set up correctly and it is serving up rails pages fine. Passenger / nginx设置正确,它可以很好地提供rails页面。 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 . 但rails安装在$ appname / shared / bundle / ruby​​ / 1.9.1 / gems中 I'd like to run rails c but can't. 我想运行rails c但不能。 How would I fix this? 我该如何解决这个问题?

edit #1 This is hosted at Linode 编辑#1这是在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

PATH=$appname/bin:$PATH

or use the bundler hook in rvm: 或者在rvm中使用bundler hook:

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: 但是,获得权限问题,所以你必须提供env:

RAILS_ENV=production bundle exec rails c

or better yet: 或者更好的是:

bundle exec rails c production

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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