我正在尝试运行capistrano更新:cap production deploy
但我收到错误:cap aborted!
LoadError: cannot load such file -- capistrano/rails
/home/deploy/apps/my-web-app/releases/20151214160634/Capfile:7:in
要求'
/ home / deploy / apps / my-web-app / releases / 20151214160634 / Capfile:7:in <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>'
我认为capistrano版本存在问题,因此我将其卸载并尝试使用&#39; 2.15&#39;但该版本给出了同样的错误。
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
...
编辑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
我将gem文件中的capistrano行移到了组外,然后运行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)>'
...
答案 0 :(得分:1)
使用bundle exec cap production deploy
确保正在使用Gemfile中声明的gem。