我正在使用Nginx,Puma和Capistrano在VPS上部署Ruby on Rails应用程序,并且在初始部署期间出现错误。
我调查了错误(这告诉我validate不是一个函数),我找到了包含错误的文件,但找不到任何解决方案。
错误:
cap production deploy:initial --trace
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
cap aborted!
NoMethodError: undefined method `validate' for main:Object
/home/nelands/.rvm/gems/ruby-2.3.7/gems/capistrano-3.11.0/lib/capistrano/defaults.rb:1:in `<top (required)>'
/usr/lib/ruby/vendor_ruby/capistrano/setup.rb:5:in `load'
/usr/lib/ruby/vendor_ruby/capistrano/setup.rb:5:in `block (2 levels) in <top (required)>'
/usr/lib/ruby/vendor_ruby/rake/task.rb:240:in `block in execute'
/usr/lib/ruby/vendor_ruby/rake/task.rb:235:in `each'
/usr/lib/ruby/vendor_ruby/rake/task.rb:235:in `execute'
/usr/lib/ruby/vendor_ruby/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/usr/lib/ruby/vendor_ruby/rake/task.rb:172:in `invoke_with_call_chain'
/usr/lib/ruby/vendor_ruby/rake/task.rb:165:in `invoke'
/usr/lib/ruby/vendor_ruby/capistrano/dsl.rb:16:in `invoke'
/usr/lib/ruby/vendor_ruby/capistrano/setup.rb:13:in `block (2 levels) in <top (required)>'
/usr/lib/ruby/vendor_ruby/rake/task.rb:240:in `block in execute'
/usr/lib/ruby/vendor_ruby/rake/task.rb:235:in `each'
/usr/lib/ruby/vendor_ruby/rake/task.rb:235:in `execute'
/usr/lib/ruby/vendor_ruby/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/usr/lib/ruby/vendor_ruby/rake/task.rb:172:in `invoke_with_call_chain'
/usr/lib/ruby/vendor_ruby/rake/task.rb:165:in `invoke'
/usr/lib/ruby/vendor_ruby/rake/application.rb:150:in `invoke_task'
/usr/lib/ruby/vendor_ruby/rake/application.rb:106:in `block (2 levels) in top_level'
/usr/lib/ruby/vendor_ruby/rake/application.rb:106:in `each'
/usr/lib/ruby/vendor_ruby/rake/application.rb:106:in `block in top_level'
/usr/lib/ruby/vendor_ruby/rake/application.rb:115:in `run_with_threads'
/usr/lib/ruby/vendor_ruby/rake/application.rb:100:in `top_level'
/usr/lib/ruby/vendor_ruby/rake/application.rb:78:in `block in run'
/usr/lib/ruby/vendor_ruby/rake/application.rb:176:in `standard_exception_handling'
/usr/lib/ruby/vendor_ruby/rake/application.rb:75:in `run'
/usr/lib/ruby/vendor_ruby/capistrano/application.rb:15:in `run'
/usr/bin/cap:3:in `<main>'
Tasks: TOP => load:defaults
default.rb文件的开头:
validate :application do |_key, value|
changed_value = value.gsub(/[^A-Z0-9\.\-]/i, "_")
if value != changed_value
warn %Q(The :application value "#{value}" is invalid!)
warn "Use only letters, numbers, hyphens, dots, and underscores. For example:"
warn " set :application, '#{changed_value}'"
raise Capistrano::ValidationError
end
end
%i(git_strategy hg_strategy svn_strategy).each do |strategy|
validate(strategy) do |key, _value|
warn(
"[Deprecation Warning] #{key} is deprecated and will be removed in "\
"Capistrano 3.7.0.\n"\
"https://github.com/capistrano/capistrano/blob/master/UPGRADING-3.7.md"
)
end
end
你能帮我吗?谢谢:)