使用capistrano部署时出现Psych Syntax错误

时间:2016-11-04 11:48:04

标签: ruby-on-rails-3 rubygems capistrano

尝试使用capistrano进行部署时出现以下错误

上限生产部署

[whenever:update_crontab] rolling back
  * executing "ls -x /home/appuser/app_assets_production/releases"
    servers: ["10.1.171.106"]
    [10.1.171.106] executing command
    command finished in 3450ms
  * executing "cd /home/appuser/app_assets_production/releases/20161103140152 && RAILS_ENV=production bundle exec whenever --update-crontab app_assets --set environment=production --roles db"
    servers: ["10.1.171.106"]
    [10.1.171.106] executing command
 ** [out :: 10.1.171.106] Using /home/appuser/.rvm/gems/ruby-2.1.2
 ** [out :: 10.1.171.106] [write] crontab file updated
    command finished in 11877ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/appuser/app_assets_production/releases/20161104113421; true"
    servers: ["10.1.171.106"]
    [10.1.171.106] executing command
 ** [out :: 10.1.171.106] Using /home/appuser/.rvm/gems/ruby-2.1.2
    command finished in 3256ms
/home/manoj/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/psych.rb:371:in `parse': (<unknown>): control characters are not allowed at line 1 column 1 (Psych::SyntaxError)
    from /home/manoj/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/psych.rb:371:in `parse_stream'
    from /home/manoj/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/psych.rb:318:in `parse'
    from /home/manoj/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/psych.rb:245:in `load'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/recipes/deploy/assets.rb:63:in `block (3 levels) in load'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:89:in `execute_task'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/callback.rb:38:in `call'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:141:in `block in trigger'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:141:in `each'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:141:in `trigger'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:23:in `invoke_task_directly_with_callbacks'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:89:in `execute_task'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/callback.rb:38:in `call'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:141:in `block in trigger'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:141:in `each'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:141:in `trigger'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:27:in `invoke_task_directly_with_callbacks'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:89:in `execute_task'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/namespaces.rb:110:in `block in define_task'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/recipes/deploy.rb:229:in `block (3 levels) in load'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:56:in `transaction'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/recipes/deploy.rb:228:in `block (2 levels) in load'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:89:in `execute_task'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/namespaces.rb:110:in `block in define_task'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/recipes/deploy.rb:196:in `block (2 levels) in load'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:89:in `execute_task'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/cli/execute.rb:46:in `block in execute_requested_actions'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/cli/execute.rb:45:in `each'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/cli/execute.rb:45:in `execute_requested_actions'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/cli/help.rb:19:in `execute_requested_actions_with_help'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/cli/execute.rb:34:in `execute!'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/lib/capistrano/cli/execute.rb:14:in `execute'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/gems/capistrano-2.14.2/bin/cap:4:in `<top (required)>'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/bin/cap:23:in `load'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/bin/cap:23:in `<main>'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/bin/ruby_executable_hooks:15:in `eval'
    from /home/manoj/.rvm/gems/ruby-2.1.2@app_assets/bin/ruby_executable_hooks:15:in `<main>'

我做了一些搜索并尝试了以下

  1. 我尝试在boot.rb中添加以下内容,然后在config / deploy.rb文件中添加以下内容。它没有工作。
  2. require 'yaml'
    YAML::ENGINE.yamler = 'syck'
    
    1. 我尝试删除manifest.yml和asset_manifest.yml文件,然后再次尝试部署。它没有工作

    2. 我检查了.bashrc文件,没有语法错误。

    3. 如果你发现我在这里失踪了,请帮忙。

1 个答案:

答案 0 :(得分:1)

我的~/.bashrc文件出错,正在加载旧的ruby版本。

查看rvm list

时出错
default [usr/bin missing ruby]
ruby-2.1.2

我删除了&#39; default&#39;来自~/.rvm/rubies/的目录,然后使用'ruby-2.1.2'rvm use ruby-2.1.2 --default指定为默认红宝石,问题就解决了。