【问题标题】:Installing Ruby with rvm1-capistrano3使用 rvm1-capistrano3 安装 Ruby
【发布时间】:2014-01-21 13:47:42
【问题描述】:

当我跑步时

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-capistrano gem 运行 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).

【问题讨论】:

  • 您的应用程序根目录确实包含以下文件之一(?):.rvmrc.versions.conf.ruby-version.rbfu-version.rbenv-version
  • @Isotope no.我刚刚添加了文件,现在我收到了不同的错误消息:ruby-2.0.0-p247 is not installed. 为什么在我尝试安装 Ruby 时会这样说?

标签: ruby-on-rails ruby rvm capistrano capistrano3


【解决方案1】:

问题

如果你去远程服务器并执行这个:

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 问题,但在我看来是这样。

解决方法

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

set :rvm1_ruby_version, "ruby-2.0.0-p247"

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

【讨论】:

    【解决方案2】:

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

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

    1.9.3
    

    或者你正在使用的任何版本的 ruby​​。

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

    some_gemset_name
    

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

    【讨论】:

    • 谢谢。我在添加的根目录中添加了.ruby-version。它的内容是ruby-2.0.0-p247。我又试了一次cap production rvm1:install:ruby,现在我得到了这个错误:ruby-2.0.0-p247 is not installed.我不明白。这就是使用 gem 的全部意义所在,不就是自动安装 rvm 和 Ruby 吗?我只是想安装 Ruby,而不是部署。
    • 这是 2 的旧补丁级别。只需在您的 .ruby-version 文件中使用 2.0.0
    • 我试过了。恐怕这并没有改变结果。该文档听起来像是开箱即用。我不明白我做错了什么。已经花了一天的时间来解决这个问题。
    • 我对这个gem不熟悉,但是你们的生产环境有没有安装rvm呢?
    • 是的,gem 有三个主要任务:cap production rvm1:install:rvm...:install:ruby:install:gems... 我已经使用包含的任务成功安装了 rvm。 github.com/rvm/rvm1-capistrano3
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-30
    • 2013-03-17
    • 1970-01-01
    相关资源
    最近更新 更多