我正在使用Capistrano帮助部署Rails项目,当我运行命令cap deploy
时,我收到以下错误。任何人都知道出了什么问题?
以下是尝试执行命令时生成的错误。
* executing "cd -- /var/www/crowdcode/releases/20130831210643 && RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile"
servers: ["54.215.187.53"]
[54.215.187.53] executing command
*** [err :: 54.215.187.53] Faraday: you may want to install system_timer for reliable timeouts
*** [err :: 54.215.187.53]
*** [err :: 54.215.187.53] rake aborted!
*** [err :: 54.215.187.53] /var/www/crowdcode/releases/20130831210643/config/initializers/redis.rb:1: syntax error, unexpected ':', expecting ')'
*** [err :: 54.215.187.53] $redis = Redis.new(host: 'localhost', port: 6379, driver: :hiredis)
*** [err :: 54.215.187.53] ^
*** [err :: 54.215.187.53] /var/www/crowdcode/releases/20130831210643/config/initializers/redis.rb:1: syntax error, unexpected ',', expecting $end
*** [err :: 54.215.187.53] $redis = Redis.new(host: 'localhost', port: 6379, driver: :hiredis)
*** [err :: 54.215.187.53] ^
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/engine.rb:588
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/engine.rb:587:in `each'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/engine.rb:587
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `run_initializers'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `send'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
*** [err :: 54.215.187.53] /var/www/crowdcode/releases/20130831210643/config/environment.rb:5
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/application.rb:103:in `require_environment!'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/application.rb:297:in `initialize_tasks'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:246:in `execute'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:184:in `invoke_with_call_chain'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/actionpack-3.2.11/lib/sprockets/assets.rake:93
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:246:in `execute'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:184:in `invoke_with_call_chain'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:205:in `invoke_prerequisites'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:203:in `each'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:203:in `invoke_prerequisites'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:183:in `invoke_with_call_chain'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/actionpack-3.2.11/lib/sprockets/assets.rake:60
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:246:in `execute'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:184:in `invoke_with_call_chain'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/actionpack-3.2.11/lib/sprockets/assets.rake:23:in `invoke_or_reboot_rake_task'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/actionpack-3.2.11/lib/sprockets/assets.rake:29
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:246:in `execute'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:184:in `invoke_with_call_chain'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/application.rb:101:in `top_level'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/application.rb:101:in `top_level'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/application.rb:73:in `run'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
*** [err :: 54.215.187.53] Tasks: TOP => environment
*** [err :: 54.215.187.53] (See full trace by running task with --trace)
command finished in 2472ms
*** [deploy:update_code] rolling back
* executing "rm -rf /var/www/crowdcode/releases/20130831210643; true"
servers: ["54.215.187.53"]
[54.215.187.53] executing command
command finished in 21ms
failed: "sh -c 'cd -- /var/www/crowdcode/releases/20130831210643 && RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile'"
编辑:这是redis.rb中的内容
$redis = Redis.new(host: 'localhost', port: 6379, driver: :hiredis)
class << $redis
def get_json_list(key)
str = "[" << $redis.lrange(key, 0, -1).join(',') << "]"
JSON.parse(str)
end
end
编辑2:
问题在于它以某种方式运行了错误的Ruby版本,从错误我们可以看到它说1.8。所以我必须确保我的系统默认为1.9.3并且瞧!没有更多语法错误,它能够正常运行。
答案 0 :(得分:0)
由于法拉第,这不是错误。这是初始化程序中的语法错误,因为此行表示:
*** [err :: 54.215.187.53] /var/www/crowdcode/releases/20130831210643/config/initializers/redis.rb:1: syntax error, unexpected ':', expecting ')'
您想检查config/initializers/redis.rb
是否存在任何语法错误。
答案 1 :(得分:0)
这是在黑暗中拍摄的。我还要验证您部署此应用程序的环境是使用相同版本的ruby和rails。
当我部署我的最后一个应用程序时,我遇到了各种语法错误并且疯狂直到我意识到我没有调整我的rvm。