1

当我跑

cap production rvm1:install:ruby

我在控制台输出的末尾收到此错误:

Command: cd ~/apps/foo/releases/20140121133714 && ( PATH=/opt/ruby/bin:$PATH /usr/bin/env /tmp/foo/rvm-auto.sh rvm install . )

无法确定使用哪个 Ruby;. 应该包含 .rvmrc 或 .versions.conf 或 .ruby-version 或 .rbfu-version 或 .rbenv-version,或 Gemfile 中的适当行。
帽子流产了!

编辑

在我的应用程序的根目录添加一个后.ruby-version,我得到的内容

DEBUG [af3b80bc] Command: cd ~/apps/foo/releases/20140121160854 && /usr/bin/env /tmp/foo/rvm-auto.sh rvm install .
DEBUG [af3b80bc]    ruby-2.0.0-p247 is not installed.
DEBUG [af3b80bc]    To install do: 'rvm install ruby-2.0.0-p247'
DEBUG [af3b80bc]    ruby-2.0.0-p247 is not installed.
DEBUG [af3b80bc]    Searching for binary rubies, this might take some time.
DEBUG [af3b80bc]    ruby-2.0.0-p247 is not installed.
DEBUG [af3b80bc]    Searching for binary rubies, this might take some time.
DEBUG [af3b80bc]    No binary rubies available for: ubuntu/12.10/x86_64/system.
DEBUG [af3b80bc]    Searching for binary rubies, this might take some time.
DEBUG [af3b80bc]    Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
DEBUG [af3b80bc]    Searching for binary rubies, this might take some time.
DEBUG [af3b80bc]    RVM does not have prediction for required space for system, assuming 150MB should be enough, let us know if it was not.
DEBUG [af3b80bc]    Searching for binary rubies, this might take some time.
DEBUG [af3b80bc]    Either the ruby interpreter is unknown or there was an error!.

我正在使用rvm1-capistranogem 运行 Capistrano 3.1.1。它是开箱即用的实现;没有什么特别的事情发生。

group :development do
  gem 'capistrano', '~> 3.1.0'
  gem 'capistrano-rails'
  gem 'capistrano-bundler'
  gem 'rvm1-capistrano3', require: false
# gem 'capistrano-rvm'
end

# capfile
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rails'
require 'capistrano/bundler'
require 'rvm1/capistrano3'
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }

我还在输出中收到另外两个错误:

Running /usr/bin/env [ -L ~/apps/foo/releases/20140121135720/public/assets ] on foo.com
Command: [ -L ~/apps/foo/releases/20140121135720/public/assets ]
Finished in 0.291 seconds with exit status 1 (failed).
Running /usr/bin/env [ -d ~/apps/foo/releases/20140121135720/public/assets ] on foo.com
Command: [ -d ~/apps/foo/releases/20140121135720/public/assets ]
Finished in 0.295 seconds with exit status 1 (failed).
4

2 回答 2

6

问题

如果您转到远程服务器并执行以下操作:

cd ~/apps/foo/releases/20140121160854 && /usr/bin/env /tmp/foo/rvm-auto.sh rvm install .

你会得到同样的错误,但如果你执行这个

cd ~/apps/foo/releases/20140121160854 && /usr/bin/env /tmp/foo/rvm-auto.sh rvm install ruby-2.0.0-p247

成功。rvm-auto.sh 执行rvm install .命令时出现问题。不确定是否是 rvm 问题,但在我看来是这样。

解决方法

如果您指定要安装的所需 ruby​​ 版本config/deploy.rb

set :rvm1_ruby_version, "ruby-2.0.0-p247"

在执行任何 rvm1 任务之前。一切都应该没问题

于 2014-01-31T12:06:25.693 回答
0

应用程序不知道要使用哪个版本的 ruby​​。

您需要做的就是将一个名为的文件添加.ruby-version到应用程序的根目录,并将其内容

1.9.3

或者您使用的任何版本的 ruby​​。

您可能还需要一个.ruby-gemset文件。在这种情况下,它的内容应该是

some_gemset_name

您可以随意调用 gemset。它在您的应用程序中是本地的。

于 2014-01-21T15:23:40.163 回答