Ruby on Rails,通过Capistrano部署安装错误

Ruby on Rails,通过Capistrano部署安装错误,ruby,ruby-on-rails-4,deployment,capistrano3,rvm-capistrano,Ruby,Ruby On Rails 4,Deployment,Capistrano3,Rvm Capistrano,我第一次在rails项目中设置Capistrano。当我运行“cap production deploy:check”时,一切正常。但当我运行“cap PRODUCTION deploy”时,它会返回以下错误 (Backtrace restricted to imported tasks) cap aborted! SSHKit::Runner::ExecuteError: Exception while executing as deploy@mysite.com: bundle exit s

我第一次在rails项目中设置Capistrano。当我运行“cap production deploy:check”时,一切正常。但当我运行“cap PRODUCTION deploy”时,它会返回以下错误

(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@mysite.com: bundle exit status: 127
bundle stdout: Nothing written
bundle stderr: /usr/bin/env: bundle: No such file or directory

SSHKit::Command::Failed: bundle exit status: 127
bundle stdout: Nothing written
bundle stderr: /usr/bin/env: bundle: No such file or directory

Tasks: TOP => deploy:updated => bundler:install
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as deploy@mysite.com: bundle exit status: 127
bundle stdout: Nothing written
bundle stderr: /usr/bin/env: bundle: No such file or directory
我使用的是rails 4.2.3。Ruby 2.2.2(带有RVM)。我在Gemfile上为capistrano添加了以下宝石

gem 'capistrano', '~> 3.4.0'
gem 'capistrano-rvm', '~> 0.1.2'
gem 'capistrano-bundler', '~> 1.1.4'
gem 'capistrano-rails', '~> 1.1.3'
gem 'capistrano3-unicorn', '~> 0.2.1'

服务器上没有安装
捆绑程序
gem。看起来像这样的线条表示:

bundle stderr: /usr/bin/env: bundle: No such file or directory

您需要在服务器上安装
bundler
gem,以便capistrano完成这项工作。

如果您使用的是rvm,则必须在capistrano文件中为您使用的ruby版本设置rvm字符串。类似于
set:rvm_ruby_string,'ree@rails3“
你说的“为ruby版本设置rvm字符串”是什么意思?”?我是这样做的吗?在
config/deploy.rb
文件中,你应该添加基本上是ruby版本的rvm字符串和你正在使用的gemset。我有同样的问题(虽然没有使用rvm):哪个bundle返回哪个bundle/home/deploy/.gem/ruby/2.3.0/bin/bundle,路径显示echo$path/home/deploy/.gem/ruby/2.3.0/bin:etc我可以手动将cd刻录到服务器上的应用程序文件夹中并运行bundle安装,运行正常,只是不在Cap 3下