gpt4 book ai didi

ruby-on-rails - 部署失败,错误为 : #

转载 作者:行者123 更新时间:2023-12-04 06:04:30 25 4
gpt4 key购买 nike

我打算将 rails 应用程序部署到 digital ocean 。
我遵循了此教程 https://gorails.com/deploy/ubuntu/14.04
然后我在本地命令提示符上运行命令进行部署。

# cap production deploy

运行命令后,我收到以下错误。
 /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

我从 stackoverflow 中发现了类似的问题。 NoMethodError: undefined method `on' for main:Object
但解决方案对我没有帮助。
我需要专家的额外帮助。
谢谢。斤

最佳答案

改变:

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

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

如果在/config/deploy.rb 中有:
lock '3.1.0'

改成:
lock '3.5.0'

并运行:
bundle update

bundle install

关于ruby-on-rails - 部署失败,错误为 : #<NoMethodError: undefined method `on' for main:Object>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36168573/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com