2013-03-31 36 views
8

我想部署一個Rails應用程序到CentOS 6/nginx /乘客服務器,但cap部署:cold給了我一個錯誤。以下是部署輸出的相關部分:在使用Capistrano映射進行部署時出現的psych.rb錯誤在這種情況下不允許使用

* 2013-03-31 17:49:59 executing `deploy:assets:update_asset_mtimes' 
    * executing "[ -e /home/appuser/apps/britaincares/shared/assets/manifest.yml ] && cat /home/appuser/apps/britaincares/shared/assets/manifest.yml || echo" 
    servers: ["www.britaincares.co.uk"] 
    [www.britaincares.co.uk] executing command 
    command finished in 303ms 
*** [deploy:update_code] rolling back 
    * executing "rm -rf /home/appuser/apps/britaincares/releases/20130331164733; true" 
    servers: ["www.britaincares.co.uk"] 
    [www.britaincares.co.uk] executing command 
** [out :: www.britaincares.co.uk] /home/appuser/.bashrc: eval: line 26: syntax error: unexpected end of file 
    command finished in 932ms 
/Users/chriswickett/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/psych.rb:203:in `parse': (<unknown>): mapping values are not allowed in this context at line 1 column 28 (Psych::SyntaxError) 
    from /Users/chriswickett/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/psych.rb:203:in `parse_stream' 
    from /Users/chriswickett/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/psych.rb:151:in `parse' 
    from /Users/chriswickett/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/psych.rb:127:in `load' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/recipes/deploy/assets.rb:63:in `block (3 levels) in load' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:138:in `instance_eval' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:89:in `execute_task' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/callback.rb:38:in `call' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:141:in `block in trigger' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:141:in `each' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:141:in `trigger' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:23:in `invoke_task_directly_with_callbacks' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:89:in `execute_task' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/callback.rb:38:in `call' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:141:in `block in trigger' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:141:in `each' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:141:in `trigger' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:27:in `invoke_task_directly_with_callbacks' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:89:in `execute_task' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/namespaces.rb:191:in `method_missing' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/namespaces.rb:110:in `block in define_task' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/recipes/deploy.rb:229:in `block (3 levels) in load' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:56:in `transaction' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/namespaces.rb:191:in `method_missing' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/recipes/deploy.rb:228:in `block (2 levels) in load' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:138:in `instance_eval' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:89:in `execute_task' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/namespaces.rb:191:in `method_missing' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/namespaces.rb:110:in `block in define_task' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/recipes/deploy.rb:517:in `block (2 levels) in load' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:138:in `instance_eval' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:89:in `execute_task' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/cli/execute.rb:46:in `block in execute_requested_actions' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/cli/execute.rb:45:in `each' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/cli/execute.rb:45:in `execute_requested_actions' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/cli/help.rb:19:in `execute_requested_actions_with_help' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/cli/execute.rb:34:in `execute!' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/lib/capistrano/cli/execute.rb:14:in `execute' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/gems/capistrano-2.14.2/bin/cap:4:in `<top (required)>' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374/bin/cap:19:in `load' 
    from /Users/chriswickett/.rvm/gems/ruby-1.9.3-p374 

Rails 3.2.1。

提到的manifest.yml文件包含'jquery.min.map' - 那是'映射不允許'部分指的是什麼?如果是這樣,我不能解決如何阻止jQuery試圖包含這個映射文件。

我試過把manifest.yml文件的上下文通過各種在線驗證器 - 它會很好。據我所知,沒有缺失的空格或標籤。

謝謝!

回答

5

我解決了這個問題。因爲Capistrano的deploy/assets.rb中的文件使用YAML.load,所以正在調用Psych。

它正在加載的變量是命令行cat命令的「捕獲」,並且因爲我的.bashrc中有語法錯誤,所以它捕獲錯誤的輸出並將它傳遞給YAML.load。修正了.bashrc錯誤,一切都很好!

19

我有這個問題,並根據myapp/shared/assets刪除了我的.json清單文件,建議here(實際上,他們建議將它們重命名,但這對我不起作用)。

+0

這對我有效。但我實際上刪除了'manifest.yml'文件。 Rails 4現在使用.json文件名中包含一個bust-string。 – Frexuz

+1

當您有兩個清單文件時,會發生此問題,無論它是一個.yml文件還是一個.json文件,甚至是兩個.json文件。我在使用capistrano-local-precompile之後發現了這種情況,它並沒有刪除以前的資產文件,並且阻止了我部署,直到我刪除了舊的清單文件 - .json文件 –

相關問題