我在部署时遇到了一些问题。 铁轨4.2.4 capistrano 3.4.0 我不明白什么是错的。有人能帮帮我吗?
$ bundle exec cap production deploy --trace ** Invoke production (first_time) ** Execute production ** Invoke load:defaults (first_time) ** Execute load:defaults cap aborted! NoMethodError: undefined method `instance' for Capistrano::Configuration:Class /home/denis/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/capistrano.rb:12:in `' config/deploy.rb:13:in `require' config/deploy.rb:13:in `' /home/denis/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/capistrano-3.4.0/lib/capistrano/setup.rb:14:in `load' /home/denis/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/capistrano-3.4.0/lib/capistrano/setup.rb:14:in `block (2 levels) in ' /home/denis/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:240:in `call' /home/denis/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:240:in `block in execute' /home/denis/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:235:in `each' /home/denis/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:235:in `execute' /home/denis/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:179:in `block in invoke_with_call_chain' /home/denis/.rbenv/versions/2.2.2/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize' /home/denis/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:172:in `invoke_with_call_chain' /home/denis/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:165:in `invoke' /home/denis/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:150:in `invoke_task' /home/denis/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:106:in `block (2 levels) in top_level' /home/denis/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:106:in `each' /home/denis/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:106:in `block in top_level' /home/denis/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:115:in `run_with_threads' /home/denis/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:100:in `top_level' /home/denis/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:78:in `block in run' /home/denis/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling' /home/denis/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:75:in `run' /home/denis/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/capistrano-3.4.0/lib/capistrano/application.rb:15:in `run' /home/denis/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/capistrano-3.4.0/bin/cap:3:in `' /home/denis/.rbenv/versions/2.2.2/bin/cap:23:in `load' /home/denis/.rbenv/versions/2.2.2/bin/cap:23:in `' Tasks: TOP => production
我的Capfile
require 'capistrano/setup' require 'capistrano/deploy' require 'capistrano/rbenv' require 'capistrano/bundler' require 'capistrano/rails/assets' require 'capistrano/rails/migrations' Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
的Gemfile
gem 'capistrano gem 'capistrano-bundler' gem 'capistrano-rails' gem 'capistrano-rbenv'
我的deploy.rb
require 'bundler/capistrano' load 'deploy/assets' set :repository, "git@bitbucket.org:test/test.git"
答案 0 :(得分:1)
您的deploy.rb不应包含require或load行。备份配置,删除Capfile
,config/deploy.rb
和config/deploy/*
,然后运行cap install
。修改生成的配置文件以便尝试。
答案 1 :(得分:1)
确保您直接在项目目录下有Capfile。如果Capfile包含类似require 'bundler/capistrano'
删除它,它应该工作。
答案 2 :(得分:0)
将以下内容添加到Capfile中,而不是config / deploy.rb:
require 'bundler/capistrano'