Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

psych.rb error when deploying with Capistrano 'mapping not allowed in this context'

I'm trying to deploy a Rails app to a CentOS 6/nginx/passenger server, but cap deploy:cold is giving me an error. Here's the relevant part from deployment output:

  * 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.

The manifest.yml file mentioned contains 'jquery.min.map' - is that what the 'mapping not allowed' part is referring to? If so, I can't work out how to stop jQuery trying to include this map file.

I've tried putting that contexts of the manifest.yml file through various online validators - it's coming up fine. No missing spaces or tabs as far as I can see.

Thanks!

like image 988
Chris Wickett Avatar asked Mar 31 '13 17:03

Chris Wickett


2 Answers

I had this issue and deleted my .json manifest files under myapp/shared/assets, as suggested here (actually, they suggested renaming them, but that didn't work for me).

like image 170
Tyler Collier Avatar answered Sep 28 '22 03:09

Tyler Collier


I solved this. Psych was being called because the file in Capistrano's deploy/assets.rb uses YAML.load.

The variable it was loading was a 'capture' of a command line cat command, and because my .bashrc had a syntax error in it, it was capturing the output of that error and passing it to YAML.load, too. Fixed .bashrc error and all is good!

like image 39
Chris Wickett Avatar answered Sep 28 '22 05:09

Chris Wickett