2016-02-05 74 views
0

我試圖運行Capistrano的更新:cap production deploy加載正確的寶石版本錯誤LoadError:無法加載這樣的文件 - Capistrano的/導軌

但我得到的錯誤:cap aborted! LoadError: cannot load such file -- capistrano/rails /home/deploy/apps/my-web-app/releases/20151214160634/Capfile:7:in需要」 /家/部署/應用/我-web應用程序/發佈/ 20151214160634/Capfile:7:<top (required)>'

這是--trace

$cap production deploy --trace 
cap aborted! 
LoadError: cannot load such file -- capistrano/rails 
/home/deploy/apps/my-web-app/releases/20151214160634/Capfile:7:in `require' 
/home/deploy/apps/my-web-app/releases/20151214160634/Capfile:7:in `<top (required)>' 
/home/deploy/apps/my-web-app/shared/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load' 
/home/deploy/apps/my-web-app/shared/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load_rakefile' 
/home/deploy/apps/my-web-app/shared/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:689:in `raw_load_rakefile' 
/home/deploy/apps/my-web-app/shared/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:94:in `block in load_rakefile' 
/home/deploy/apps/my-web-app/shared/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling' 
/home/deploy/apps/my-web-app/shared/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:93:in `load_rakefile' 
/home/deploy/apps/my-web-app/shared/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:77:in `block in run' 
/home/deploy/apps/my-web-app/shared/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling' 
/home/deploy/apps/my-web-app/shared/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run' 
/home/deploy/apps/my-web-app/shared/bundle/ruby/2.1.0/gems/capistrano-3.4.0/lib/capistrano/application.rb:15:in `run' 
/home/deploy/apps/my-web-app/shared/bundle/ruby/2.1.0/gems/capistrano-3.4.0/bin/cap:3:in `<top (required)>' 
/home/deploy/.rvm/gems/ruby-2.1.7/bin/cap:23:in `load' 
/home/deploy/.rvm/gems/ruby-2.1.7/bin/cap:23:in `<main>' 
/home/deploy/.rvm/gems/ruby-2.1.7/bin/ruby_executable_hooks:15:in `eval' 
/home/deploy/.rvm/gems/ruby-2.1.7/bin/ruby_executable_hooks:15:in `<main>' 

我相信這是與CA的版本問題pistrano,所以我卸載它並用'2.15'試過,但該版本給出了相同的錯誤。

Capistrano的是在我的Gemfile定義如下:

... 
group :development do 
    gem 'capistrano',   require: false 
    gem 'capistrano-rvm',  require: false 
    gem 'capistrano-rails', require: false 
    gem 'capistrano-bundler', require: false 
    gem 'capistrano3-puma', require: false 
... 

EDIT 1

bundle exec cap production deploy 

給出:

/home/deploy/.rvm/gems/ruby-2.1.7/gems/bundler-1.10.6/lib/bundler/rubygems_integration.rb:292:in `block in replace_gem': capistrano is not part of the bundle. Add it to Gemfile. (Gem::LoadError) 
from /home/deploy/apps/my-web-app/shared/bundle/ruby/2.1.0/bin/cap:22:in `<main>' 

編輯2

我將capistrano行移動到組外的gemfile中,然後運行rvmsudo bundle install

現在bundle exec cap production deploy gives

bundle exec cap production deploy --trace 
** Invoke production (first_time) 
** Execute production 
** Invoke load:defaults (first_time) 
** Execute load:defaults 
cap aborted! 
NameError: undefined local variable or method `config' for main:Object 
config/deploy/production.rb:35:in `<top (required)>' 
... 

回答

1

使用bundle exec cap production deploy,以確保正在使用您的Gemfile聲明的寶石。

+0

感謝您的答案,請參閱編輯1,它給了我那個錯誤 – Rorschach

+0

看起來你的原始問題已經解決了,對吧? –

相關問題