【发布时间】:2016-02-05 19:14:08
【问题描述】:
我正在尝试运行 capistrano 更新:cap production deploy
但我得到了错误:cap aborted!
LoadError: cannot load such file -- capistrano/rails
/home/deploy/apps/my-web-app/releases/20151214160634/Capfile:7:inrequire'
/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 的版本存在问题,因此我将其卸载并使用“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
...
编辑 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
我将 gemfile 中的 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)>'
...
【问题讨论】:
标签: ruby-on-rails rubygems capistrano