Capistrano 2をRails 3プロジェクトで使用しています。最近、gemsetフォームのスクラッチを再構築しましたが、「このファイルをCapistranoレシピ(LoadError)内から要求してください。 run Rails server。
詳細なエラーメッセージ:
/Users/leonidlukin/.rvm/rubies/Ruby-1.9.3-p429/bin/Ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/leonidlukin/Sites/moscowshows/script/Rails server -b 0.0.0.0 -p 3000 -e development
/Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:18:in `instance': Please require this file from within a Capistrano recipe (LoadError)
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/rvm-capistrano-1.5.6/lib/rvm/capistrano/helpers/base.rb:16:in `rvm_with_capistrano'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/rvm-capistrano-1.5.6/lib/rvm/capistrano/helpers/_cset.rb:3:in `<top (required)>'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/rvm-capistrano-1.5.6/lib/rvm/capistrano/base.rb:1:in `<top (required)>'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/rvm-capistrano-1.5.6/lib/rvm/capistrano/selector.rb:1:in `<top (required)>'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/rvm-capistrano-1.5.6/lib/rvm/capistrano.rb:3:in `<top (required)>'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/bundler-1.8.0/lib/bundler/runtime.rb:85:in `require'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/bundler-1.8.0/lib/bundler/runtime.rb:85:in `rescue in block in require'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/bundler-1.8.0/lib/bundler/runtime.rb:68:in `block in require'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/bundler-1.8.0/lib/bundler/runtime.rb:61:in `each'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/bundler-1.8.0/lib/bundler/runtime.rb:61:in `require'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/bundler-1.8.0/lib/bundler.rb:134:in `require'
from /Users/leonidlukin/Sites/moscowshows/config/application.rb:13:in `<top (required)>'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/railties-3.2.13/lib/Rails/commands.rb:53:in `require'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/railties-3.2.13/lib/Rails/commands.rb:53:in `block in <top (required)>'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/railties-3.2.13/lib/Rails/commands.rb:50:in `tap'
from /Users/leonidlukin/.rvm/gems/Ruby-1.9.3-p429@moscowshows/gems/railties-3.2.13/lib/Rails/commands.rb:50:in `<top (required)>'
from /Users/leonidlukin/Sites/moscowshows/script/Rails:6:in `require'
from /Users/leonidlukin/Sites/moscowshows/script/Rails:6:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
Process finished with exit code 1
Capistranoレシピ内で必要なファイルはどれですか?
問題はrvm-capistranoにあります。
Gemfileで修正してください。 必須:false
gem 'rvm-capistrano', require: false
これは役立つはずです
rvm-capistranoをcapistranoの前に移動することで、削除する代わりに、より良い解決策を見つけました。
# Deploy with Capistrano
gem 'rvm-capistrano'
gem 'capistrano'
gem 'capistrano-ext'
しかし、奇妙なことに、私はこの問題もそのように解決しました(私のGemfileでは、主なcapistrano gemをコメントするためだけです):
# Deploy with Capistrano
# gem 'capistrano', :group => :development
gem 'rvm-capistrano', :group => :development
Gemfileでこれを変更します。
gem 'rvm-capistrano', require: false
これにより、頭痛なく問題を解決できます。