我正在尝试使用Capistrano将项目部署到分期。但是,我继续得到
NoMethodError: undefined method `split' for nil:NilClass
无论我尝试多少种方法。
这是我的步骤:
在服务器上
RAILS_ENV=staging rake assets:clobber
RAILS_ENV=staging rake assets:precompile
本地
cap staging deploy
Command: cd /data/site/releases/20180620140908 && ( export RAILS_ENV="staging" RAILS_GROUPS="" ; ~/.rvm/bin/rvm 2.2.2@site do bundle exec rake assets:precompile )
rake aborted!
NoMethodError: undefined method `split' for nil:NilClass
感谢您的帮助!我可以提供任何需要解决这个问题的东西。
编辑:这是在运行“捆绑exec帽登台部署--trace”之后出现的更多错误
** Execute deploy:updated
** Invoke deploy:compile_assets (first_time)
** Invoke deploy:set_rails_env
** Execute deploy:compile_assets
** Invoke deploy:assets:precompile (first_time)
** Execute deploy:assets:precompile
DEBUG [26939f9d] Running if test ! -d /data/site/releases/20180620153200; then echo "Directory does not exist '/data/site/releases/20180620153200'" 1>&2; false; fi as ubuntu@staging.site.com
DEBUG [26939f9d] Command: if test ! -d /data/site/releases/20180620153200; then echo "Directory does not exist '/data/site/releases/20180620153200'" 1>&2; false; fi
DEBUG [26939f9d] Finished in 0.098 seconds with exit status 0 (successful).
INFO [744200b0] Running ~/.rvm/bin/rvm 2.2.2@site do bundle exec rake assets:precompile as ubuntu@staging.site.com
DEBUG [744200b0] Command: cd /data/site/releases/20180620153200 && ( export RAILS_ENV="staging" RAILS_GROUPS="" ; ~/.rvm/bin/rvm 2.2.2@site do bundle exec rake assets:precompile )
DEBUG [744200b0] rake aborted!
DEBUG [744200b0] NoMethodError: undefined method `split' for nil:NilClass
DEBUG [744200b0] /data/site/shared/bundle/ruby/2.2.0/gems/rollbar-
1.5.3/lib/rollbar/rake.rb:23:in `patch?'
/data/site/shared/bundle/ruby/2.2.0/gems/rollbar-1.5.3/lib/rollbar/rake.rb:6:in `patch!'
/data/site/shared/bundle/ruby/2.2.0/gems/rollbar-1.5.3/lib/rollbar/rake.rb:38:in `<top (required)>'
/data/site/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/data/site/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
/data/site/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/data/site/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/data/site/shared/bundle/ruby/2.2.0/gems/rollbar-1.5.3/lib/rollbar.rb:749:in `require_hooks'
/data/site/shared/bundle/ruby/2.2.0/gems/rollbar-1.5.3/lib/rollbar.rb:713:in `configure'
/data/site/releases/20180620153200/config/initializers /rollbar.rb:2:in `<top (required)>'
/data/site/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
/data/site/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `block in load'
/data/site/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/data/site/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
/data/site/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:652:in `block in load_config_initializer'
/data/site/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:166:in `instrument'
/data/site/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:651:in `load_config_initializer'
/data/site/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
/data/site/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:615:in `each'
/data/site/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:615:in `block in <class:Engine>'
/data/site/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `instance_exec'
/data/site/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `run'
/data/site/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'
/data/site/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:44:in `each'
/data/site/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:44:in `tsort_each_child'
/data/site/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:54:in `run_initializers'
/data/site/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:352:in `initialize!'
/data/site/releases/20180620153200/config/environment.rb:5:in `<top (required)>'
/data/site/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/data/site/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
/data/site/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/data/site/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/data/site/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:328:in `require_environment!'
/data/site/shared/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:457:in `block in run_tasks_blocks'
/data/site/shared/bundle/ruby/2.2.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
/data/site/shared/bundle/ruby/2.2.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
DEBUG [744200b0] Tasks: TOP => environment
DEBUG [744200b0] (See full trace by running task with --trace)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as ubuntu@staging.site.com: rake exit status: 1
rake stdout: Nothing written
rake stderr: rake aborted!
NoMethodError: undefined method `split' for nil:NilClass
解决方案:
我只需要更新我的gemfile即可包含rake和rollbar的最新版本
答案 0 :(得分:0)
这是rollbar
gem的已记录问题。
https://github.com/rollbar/rollbar-gem/issues/411
使用bundle update rollbar
答案 1 :(得分:0)
就我而言,我必须在命令下运行
sudo apt-get install libmysqlclient-dev
在那之后效果很好。