【发布时间】:2015-08-19 09:47:19
【问题描述】:
我正在尝试使用 capistrano 部署 Rails 站点。我在服务器上有 2 个 rails 站点,一个使用 ruby 2.1.2,这个 capistrano 一个使用 2.2.2。当我运行“cap production deploy”时,出现以下错误...
[93a28357] Your Ruby version is 2.1.2, but your Gemfile specified 2.2.2
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@mysite.com: bundle exit status: 18
bundle stdout: Your Ruby version is 2.1.2, but your Gemfile specified 2.2.2
bundle stderr: Nothing written
SSHKit::Command::Failed: bundle exit status: 18
bundle stdout: Your Ruby version is 2.1.2, but your Gemfile specified 2.2.2
bundle stderr: Nothing written
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: 18
bundle stdout: Your Ruby version is 2.1.2, but your Gemfile specified 2.2.2
bundle stderr: Nothing written
在我的“deply.rb”文件中,我有以下内容...
set :rvm_ruby_string, :local
使用的宝石...
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'
【问题讨论】:
-
你的 gemfile 中有
ruby "x.y.z"吗? -
是的,在我的 Gemfile 我有:ruby '2.2.2'
-
您正在将指定 ruby 版本 2.2.2 的 Gemfile 上传到您明确要使用 2.1.2 的机器上。这永远不会奏效。您应该考虑从 Gemfile 中删除 ruby 声明,并将其留给环境处理。
-
当我从我的 Gemfile 中删除 'ruby '2.2.2'' 时它可以工作。但是现在它使用的是 ruby 2.1.2,我在本地使用 2.2.2 并且想在生产服务器上使用 2.2.2,我怎样才能让它使用 2.2.2?
-
从错误输出中,服务器不知道 ruby 2.2.2。你在那里安装了吗?您是否将其设置为运行应用程序的环境的默认 ruby 版本?
标签: ruby-on-rails-4 capistrano3 rvm-capistrano