Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Psych Syntax error when deploying using capistrano

I get the following error when trying to deploy using capistrano

cap production deploy

[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>'

I did some search and tried the following

  1. I tried to add the following in boot.rb, then config/deploy.rb file, It didn't work.
require 'yaml'
YAML::ENGINE.yamler = 'syck'
  1. I tried removing manifest.yml and asset_manifest.yml file, then tried to deploy again. It didn't work

  2. I checked .bashrc file and there is no syntax error.

Kindly help if you find what I am missing here.

like image 580
Mano Avatar asked Nov 04 '16 11:11

Mano


1 Answers

There was an error in my ~/.bashrc file, that was loading the old ruby version.

There was en error when I viewed my rvm list

default [usr/bin missing ruby]
ruby-2.1.2

I removed 'default' directory from ~/.rvm/rubies/ then assigned 'ruby-2.1.2' as default ruby using rvm use ruby-2.1.2 --default and the issue got solved.

like image 75
Mano Avatar answered Nov 12 '22 10:11

Mano