質問

When I run

cap production rvm1:install:ruby

I get this error at the end of the console output:

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

Could not determine which Ruby to use; . should contain .rvmrc or .versions.conf or .ruby-version or .rbfu-version or .rbenv-version, or an appropriate line in Gemfile.
cap aborted!

EDIT

After adding an .ruby-version at the root of my app, with the contents I get

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!.

I'm running Capistrano 3.1.1 with rvm1-capistrano gem. It's out of the box implementation; nothing special going on.

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 }

I'm also getting two other errors in the output:

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).
役に立ちましたか?

解決

Problem

If you go to the remote server and execute this:

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

you will get the same error but if you execute this instead

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

success. The problem appears when rvm-auto.sh execute the rvm install . command. Not sure if is a rvm problem but it looks so to my eyes..

Workaround

If you specify the desired version of ruby to install in config/deploy.rb:

set :rvm1_ruby_version, "ruby-2.0.0-p247"

before executing any rvm1 tasks. Everything should be fine

他のヒント

The application does not know which version of ruby to use.

All you need to do is add a file called .ruby-version to the root of your application, and have its contents be

1.9.3

Or whatever version of ruby you are using.

You may also need a .ruby-gemset file. In which case, its contents should be

some_gemset_name

You can call your gemset whatever you want. It is local to your application.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top