问题描述
我设置了Capistrano来部署我的应用程序。我做了一个步骤,所以我首先设置代码部署,所以我评论了所有的角色,但$ code>:app 。我正在使用 rvm
,我有一些问题。最大的问题是一个错误,说 / usr / bin / env:ruby:没有这样的文件或目录
。我使用gem capistrano / rvm
并在 Capfile
中要求它,并将以下行添加到 deploy.rb
file:
set:default_env,{path:/ usr /local/rvm/gems/ruby-2.0.0-p247@global/bin:$PATH}
一旦代码部署正常,我激活了de :db
角色,以执行迁移。我收到相同的错误,但是这次我找不到解决方案。
〜$ cap production deploy:migrate
...
...
INFO [85d6241d]运行bundle exec rake db:migrate on 10.10.51.10
DEBUG [85d6241d]命令:cd [PROJECT_SRC] / current
&& (PATH=/usr/local/rvm/gems/ruby-2.0.0-p247@global/bin:$ PATH RAILS_ENV =生产包exec rake db:migrate)
DEBUG [85d6241d] / usr / bin / env :ruby:没有这样的文件或目录
帽中止!
当我直接在shell中执行它时,此命令正常运行。
提前谢谢!
最后使用 gem'rvm1 -capistrano3',require:false
。这似乎是我的设置(Rails4.0.1,ruby-2.0.0-p247,capistrano3)的最佳选择。它不需要特殊配置。
您可以在找到它。
希望它帮助某人!
I set up Capistrano to make the deploy of my app. I made it in steps, so first I set up the code deployment, so I commented all the roles but :app
.
I'm using rvm
and I had some problems with it. The biggest problem was an error that said /usr/bin/env: ruby: No such file or directory
. I solved them using the gem capistrano/rvm
and requiring it in the Capfile
and adding the following line to the deploy.rb
file:
set :default_env, { path: "/usr/local/rvm/gems/ruby-2.0.0-p247@global/bin:$PATH" }
Once the code deploying runned correctly I activated de :db
role in order to perform migrations. I get the same error but I can't find the solution this time.
~$ cap production deploy:migrate
…
…
INFO [85d6241d] Running bundle exec rake db:migrate on 10.10.51.10
DEBUG [85d6241d] Command: cd [PROJECT_SRC]/current
&& ( PATH=/usr/local/rvm/gems/ruby-2.0.0-p247@global/bin:$PATH RAILS_ENV=production bundle exec rake db:migrate )
DEBUG [85d6241d] /usr/bin/env: ruby: No such file or directory
cap aborted!
This command runs correctly when I execute it directly in the shell.
Thank you in advance!
Finally it worked using gem 'rvm1-capistrano3', require: false
. It seems the best option for my setup (Rails4.0.1, ruby-2.0.0-p247, capistrano3). It didn't require special configuration.
You can find it here.
Hope it helps someone!
这篇关于Capistrano throws / usr / bin / env:ruby:执行deploy:migration时没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!