Skip to main content

Deployment Question

Servers • Asked by Chris Zempel

Hey, debugging a deployment script I didn't set up and running into an error that I'm not making any headway with via StackOverflow or general Googling.

Here's what it is:

bundle exec cap staging deploy
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/capistrano-3.1.0/lib/capistrano/i18n.rb:4: warning: duplicated key at line 6 ignored: :starting
cap aborted!
NoMethodError: undefined method `on' for main:Object
/Users/chris/.rbenv/versions/2.2.4/bin/cap:23:in `load'
/Users/chris/.rbenv/versions/2.2.4/bin/cap:23:in `<main>'
Tasks: TOP => rbenv:validate
(See full trace by running task with --trace)

here's a version with trace:

bundle exec cap staging deploy --trace
/Users/chris/.rbenv/versions/2.2.4/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 staging (first_time)
** Execute staging
** 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 rbenv:validate (first_time)
** Execute rbenv:validate
cap aborted!
NoMethodError: undefined method `on' for main:Object
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/bundler/gems/rbenv-e056efc0c361/lib/capistrano/tasks/rbenv.rake:3:in `block (2 levels) in <top (required)>'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/capistrano-3.1.0/lib/capistrano/dsl/task_enhancements.rb:12:in `block in after'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/application.rb:150:in `invoke_task'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `each'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `block in top_level'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/application.rb:115:in `run_with_threads'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/application.rbin `top_level'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/application.rb:78:in `block in run'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/capistrano-3.1.0/lib/capistrano/application.rb:15:in `run'
/Users/chris/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/capistrano-3.1.0/bin/cap:3:in `<top (required)>'
/Users/chris/.rbenv/versions/2.2.4/bin/cap:23:in `load'
/Users/chris/.rbenv/versions/2.2.4/bin/cap:23:in `<main>'
Tasks: TOP => rbenv:validate

I think its referring to this, but not really sure what's happening beyond that point.


You might want to update to the latest Capistrano. https://github.com/capistrano/capistrano/issues/1641


This project is on 4.2.0, but I'll give it a shot


The Rails version doesn't matter because the error is in Capistrano and there's a missing compatibility thing somewhere internally.


That worked! Thanks. Now I'm bumping into a different error, but I'll try and handle it from here.


Feel free to post it here so other people can find it and the solution. Which version did you upgrade to? 3.4.0?


Yeah. So there were several errors, some app-specific that others wouldn't have to deal with, but here's the one that probably matters:

gem 'capistrano', '~> 3.1.0' -> gem 'capistrano', '~> 3.4'

gem 'capistrano-bundler', '~> 1.1.2' -> gem 'capistrano-bundler', '~> 1.1', '>= 1.1.4 '

# Now the issue was, on deploy, a variety of gems weren't being detected/used properly. In my case, 
# it was jwt-something. To resolve this:

delete Gemfile.lock
bundle install

# or 

bundle update

# then run your deploy and you should be ready to roll!

# bundle exec cap staging deploy:migrate didn't seem to be working, had to go run those manually

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 27,623+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.