Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The deploy has failed with an error: #<NoMethodError: undefined method `on' for main:Object>

I am going to deploy rails app to digital ocean.
I followed the tutorial for this https://gorails.com/deploy/ubuntu/14.04
And then I run the command on local command prompt for deploying.

# cap production deploy

After running the command, I got the following error.

 /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/capistrano-3.1.0/lib/capistrano/i18n.rb:4: warning: duplicated key at line 6 ignored: :starting
    ** Invoke production (first_time)
    ** Execute production
    ** Invoke load:defaults (first_time)
    ** Execute load:defaults
    ** Invoke bundler:map_bins (first_time)
    ** Execute bundler:map_bins
    ** Invoke deploy:set_rails_env (first_time)
    ** Execute deploy:set_rails_env
    ** Invoke deploy:set_linked_dirs (first_time)
    ** Execute deploy:set_linked_dirs
    ** Invoke deploy:set_rails_env 
    ** Invoke deploy (first_time)
    ** Execute deploy
    ** Invoke deploy:starting (first_time)
    ** Execute deploy:starting
    ** Invoke deploy:check (first_time)
    ** Execute deploy:check
    ** Invoke git:check (first_time)
    ** Invoke git:wrapper (first_time)
    ** Execute git:wrapper
    cap aborted!
    NoMethodError: undefined method `on' for main:Object
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/capistrano-3.1.0/lib/capistrano/tasks/git.rake:16:in `block (2 levels) in <top (required)>'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:248:in `call'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:248:in `block in execute'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:243:in `each'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:243:in `execute'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:180:in `invoke_with_call_chain'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:209:in `block in invoke_prerequisites'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:207:in `each'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:207:in `invoke_prerequisites'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:186:in `block in invoke_with_call_chain'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:180:in `invoke_with_call_chain'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:173:in `invoke'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/capistrano-3.1.0/lib/capistrano/dsl.rb:14:in `invoke'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/capistrano-3.1.0/lib/capistrano/tasks/deploy.rake:34:in `block (2 levels) in <top (required)>'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:248:in `call'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:248:in `block in execute'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:243:in `each'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:243:in `execute'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:180:in `invoke_with_call_chain'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:173:in `invoke'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/capistrano-3.1.0/lib/capistrano/dsl.rb:14:in `invoke'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/capistrano-3.1.0/lib/capistrano/tasks/deploy.rake:4:in `block (2 levels) in <top (required)>'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:248:in `call'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:248:in `block in execute'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:243:in `each'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:243:in `execute'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:180:in `invoke_with_call_chain'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:173:in `invoke'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/capistrano-3.1.0/lib/capistrano/dsl.rb:14:in `invoke'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/capistrano-3.1.0/lib/capistrano/tasks/framework.rake:65:in `block (2 levels) in <top (required)>'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/capistrano-3.1.0/lib/capistrano/tasks/framework.rake:64:in `each'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/capistrano-3.1.0/lib/capistrano/tasks/framework.rake:64:in `block in <top (required)>'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:248:in `call'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:248:in `block in execute'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:243:in `each'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:243:in `execute'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:180:in `invoke_with_call_chain'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:173:in `invoke'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/application.rb:150:in `invoke_task'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/application.rb:106:in `block (2 levels) in top_level'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/application.rb:106:in `each'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/application.rb:106:in `block in top_level'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/application.rb:115:in `run_with_threads'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/application.rb:100:in `top_level'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/application.rb:78:in `block in run'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/application.rb:176:in `standard_exception_handling'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-11.1.1/lib/rake/application.rb:75:in `run'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/capistrano-3.1.0/lib/capistrano/application.rb:15:in `run'
    /Users/llvc/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/capistrano-3.1.0/bin/cap:3:in `<top (required)>'
    /Users/llvc/.rbenv/versions/2.2.3/bin/cap:23:in `load'
    /Users/llvc/.rbenv/versions/2.2.3/bin/cap:23:in `<main>'
    Tasks: TOP => git:check => git:wrapper
    The deploy has failed with an error: #<NoMethodError: undefined method `on' for main:Object>
    ** Invoke deploy:failed (first_time)
    ** Execute deploy:failed

I found out the similar problems from stackoverflow.NoMethodError: undefined method `on' for main:Object
But the solution couldn't help me. I need extra help from experts. Thanks. Jin

like image 535
Jin Hong Avatar asked Mar 13 '23 20:03

Jin Hong


1 Answers

change:

gem 'capistrano', '~> 3.1.0'
gem 'capistrano-bundler', '~> 1.1.2'
gem 'capistrano-rails', '~> 1.1.1'

to:

gem 'capistrano',            '~>3.5.0'
gem 'capistrano-bundler',   '~> 1.1.3'
gem 'capistrano-rails',     '~> 1.1.7'

if in /config/deploy.rb there is:

lock '3.1.0'

change to:

lock '3.5.0'

and run:

bundle update

bundle install
like image 109
ChaosPredictor Avatar answered Mar 22 '23 09:03

ChaosPredictor