【发布时间】:2016-04-28 05:03:57
【问题描述】:
我在多用户、多服务器环境 (Site5) 中进行部署。
我正在部署一个 rails 4 应用程序。默认环境是 ruby 1.8.7,rails 3.0。
可以访问本地版本的 ruby,
在调用捆绑程序之前一切正常。
这是错误sn-p:
INFO [4439d586] Running /usr/bin/env bundle install --path /home/username/apps/todos/shared/bundle --without development test --deployment --quiet as username@dirktaylor.ca
DEBUG [4439d586] Command: cd /home/username/apps/todos/releases/20160121174533 && ( export RUBY_BIN_PATH="/usr/local/ruby20/bin" PATH="/usr/local/ruby20/bin:/usr/username/ruby/gems/gems/bundler-1.11.2/exe:$PATH" ; /usr/bin/env bundle install --path /home/username/apps/todos/shared/bundle --without development test --deployment --quiet )
DEBUG [4439d586] Gem::InstallError: i18n requires Ruby version >= 1.9.3.
DEBUG [4439d586] An error occurred while installing i18n (0.7.0), and Bundler cannot continue.
Make sure that `gem install i18n -v '0.7.0'` succeeds before bundling.
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as username@dirktaylor.ca: bundle exit status: 5
bundle stdout: Gem::InstallError: i18n requires Ruby version >= 1.9.3.
An error occurred while installing i18n (0.7.0), and Bundler cannot continue.
Make sure that `gem install i18n -v '0.7.0'` succeeds before bundling.
bundle stderr: Nothing written
如你所见,我在调用 bundle 命令之前设置环境变量。
所以,这就是我的想法......
因为 Capistrano 3 正在使用 /usr/bin/env 和 /usr/bin/env bundle install ... 执行所有操作,所以它找不到要使用的正确版本的捆绑程序。
username@dirktaylor.ca [~2]# /usr/bin/env bundle -v;whereis bundle
Bundler version 1.2.1
bundle: /usr/bin/bundle
(注意: /usr/bin/env 链接到 /bin/env )
我已经安装了 bundler 的当前用户 (gem install bundler),它现在位于 ~/ruby/gems/gems/bundler-1.11.2 中,可执行脚本位于 ~/ruby/gems/gems/bundler-1.11.2 /exe/包
所以?现在呢?
1) 我怎样才能让这个版本的捆绑器执行?
2) 此外,在脚本内部它调用#!/usr/bin/env ruby。我应该将其更改为正确的红宝石路径吗?
3)我在其他地方看到了 Cap 2 的这个解决方案:
set :bundle_cmd, "/usr/username/ruby/gems/gems/bundler-1.11.2/exe/bundle"
set :bundle_dir, "/usr/username/ruby/gems/gems/bundler-1.11.2"
所以问题仍然存在:如何更改 Capistrano 3 中调用的捆绑程序?
(最后:没有rvm可以解决这个问题吗?)
【问题讨论】:
标签: ruby-on-rails ruby capistrano bundler