Capistrano部署的精神错误

lif*_*der 5 linux deployment ubuntu capistrano ruby-on-rails-3

我有一个Capistrano部署脚本已经工作了一段时间,但现在它在部署时抛出了这样的错误:

/Users/lifecoder/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/psych.rb:203:in `parse': (<unknown>): control characters are not allowed at line 1 column 1 (Psych::SyntaxError)
    from /Users/lifecoder/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
    from /Users/lifecoder/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/psych.rb:151:in `parse'
    from /Users/lifecoder/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/psych.rb:127:in `load'
...
Run Code Online (Sandbox Code Playgroud)

它在部署期间还会抛出几个警告:

 ** [out :: test.domain] Warning! PATH is not properly set up, '/home/lifecoder/.rvm/gems/ruby-1.9.3-p448/bin' is not at first place,
 ** [out :: test.domain]
 ** [out :: test.domain] usually this is caused by shell initialization files - check them for 'PATH=...' entries,
 ** [out :: test.domain]
 ** [out :: test.domain] to fix run: 'rvm use ruby-1.9.3-p448'.
Run Code Online (Sandbox Code Playgroud)

我在这里发现了类似的问题,并假设这个警告实际上是心理崩溃的原因.但我无法摆脱它,PATH实际上对我来说很好,当我通过ssh连接并检查它时,rvm 第一位的:

$ echo $PATH
/home/lifecoder/.rvm/gems/ruby-1.9.3-p448/bin:/home/lifecoder/.rvm/gems/ruby-1.9.3-p448@global/bin:/home/lifecoder/.rvm/rubies/ruby-1.9.3-p448/bin:/home/lifecoder/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
Run Code Online (Sandbox Code Playgroud)

我对*nix不太熟练,所以我可能会错过一些东西 - 但是找不到确切的东西.

我知道它可能通过YAML解析器引擎更改或通过删除某处的YAML文件来修复,因此Psych无法启动,但我更愿意以正确的方式解决此问题.

UPD1:我在Capistrano脚本中添加了一个带有'use rvm'的钩子,然后它返回'RVM不是函数'.似乎它没有加载bashrc /其他init脚本.

UPD2:是的,它不会加载bash,但是当我启用bash时它变得更糟.作为临时解决方案,我禁用了capistrano/assets.似乎我只需要擦除复制粘贴的capistrano脚本并从头开始重写它.

lif*_*der 1

当 Capistrano 登录时 - 它使用非交互式 shell \xe2\x80\x94 它不会加载 .bash_profile\n因此,我已将 bash 加载为Deployment.rb 中的默认shell

\n\n
default_run_options[:shell] = \'/bin/bash\'\n
Run Code Online (Sandbox Code Playgroud)\n\n

然后将 RVM 加载脚本从 .bash_profile 移动到 .bashrc

\n\n
#.bash_profile\nsource ~/.bashrc\n\n\n\n#.bashrc\n[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*\n
Run Code Online (Sandbox Code Playgroud)\n