Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
901 views
in Technique[技术] by (71.8m points)

ruby on rails - Why am I getting a Psych error when trying to deploy with capistrano?

I am currently setting up capistrano in my Rails 3.2.13 app. I am getting the below error/details (including "control characters are not allowed at line 1 column 1"). I have done some searching for this but do not see anything related to me.

I am using rvm-capistrano and ruby 2.0.0-p195. I recently moved my app-required environment variables into .bashrc.

...      
* 2013-06-10 15:18:32 executing `deploy:assets:update_asset_mtimes'
      * executing "[ -e /home/deployer/apps/super_rad_app/shared/assets/manifest* ] && cat /home/deployer/apps/super_rad_app/shared/assets/manifest* || echo"
        servers: ["107.20.249.163"]
        [107.20.249.163] executing command
        command finished in 6238ms
    *** [deploy:update_code] rolling back
      * executing "rm -rf /home/deployer/apps/super_rad_app/releases/20130610221258; true"
        servers: ["107.20.249.163"]
        [107.20.249.163] executing command
     ** [out :: 107.20.249.163] Using /home/deployer/.rvm/gems/ruby-2.0.0-p195
        command finished in 6623ms
    /home/nate/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/psych.rb:205:in `parse': (<unknown>): control characters are not allowed at line 1 column 1 (Psych::SyntaxError)
        from /home/nate/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/psych.rb:205:in `parse_stream'
        from /home/nate/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/psych.rb:153:in `parse'
        from /home/nate/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/psych.rb:129:in `load'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/recipes/deploy/assets.rb:26:in `parse_manifest'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/recipes/deploy/assets.rb:93:in `block (3 levels) in load'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:89:in `execute_task'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/callback.rb:38:in `call'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/callbacks.rb:141:in `block in trigger'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/callbacks.rb:141:in `each'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/callbacks.rb:141:in `trigger'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/callbacks.rb:23:in `invoke_task_directly_with_callbacks'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:89:in `execute_task'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/callback.rb:38:in `call'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/callbacks.rb:141:in `block in trigger'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/callbacks.rb:141:in `each'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/callbacks.rb:141:in `trigger'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/callbacks.rb:27:in `invoke_task_directly_with_callbacks'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:89:in `execute_task'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/namespaces.rb:110:in `block in define_task'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/recipes/deploy.rb:234:in `block (3 levels) in load'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:56:in `transaction'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/recipes/deploy.rb:233:in `block (2 levels) in load'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:89:in `execute_task'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/namespaces.rb:110:in `block in define_task'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/recipes/deploy.rb:201:in `block (2 levels) in load'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:89:in `execute_task'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/cli/execute.rb:46:in `block in execute_requested_actions'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/cli/execute.rb:45:in `each'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/cli/execute.rb:45:in `execute_requested_actions'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/cli/help.rb:19:in `execute_requested_actions_with_help'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/cli/execute.rb:34:in `execute!'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/cli/execute.rb:14:in `execute'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/bin/cap:4:in `<top (required)>'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/bin/cap:23:in `load'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/bin/cap:23:in `<main>'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/bin/ruby_noexec_wrapper:14:in `eval'
        from /home/nate/.rvm/gems/ruby-2.0.0-p195/bin/ruby_noexec_wrapper:14:in `<main>'
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I also had this problem, but for a different reason. We are using rvm-capistrano, and our project has a .rvmrc file. The deploy:assets:update_asset_mtimes Capistrano task runs a shell command on the server to capture the contents of the assets manifest. The presence of the .rvmrc file in the deploy generated a "You are using '.rvmrc', it requires trusting..." warning from RVM, which inadvertently became part of the output of the shell command. I only saw this after instrumenting the assets.rb recipe in my local capistrano gem with a puts statement.

I fixed my issue by running "rvm rvmrc warning ignore all.rvmrcs" on the server, and then deploying again.

Another option would be to switch away from .rvmrc and the whole trusting thing to use the .ruby-version approach. See Use rvmrc or ruby-version file to set a project gemset with RVM? for details.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...