2016-02-05 59 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

看起来你的原始问题已经解决了,对吧? –

相关问题