我有一个已经工作了一段时间的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'
...它还会在部署期间抛出几个警告:
** [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'.我发现了类似的问题,here,并假设这个警告实际上是精神崩溃的原因。但是我无法摆脱它,这条路径对我来说确实不错,当我通过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我不太精通*nix,所以我可能错过了什么--但找不到确切的内容。
我知道它可能是通过YAML解析器引擎的更改来修复的,或者通过在某个地方删除YAML文件而不会启动,但是我更愿意用正确的方式解决这个问题。
UPD1:我在Capistrano脚本中添加了一个带有“use”的钩子,并返回'RVM不是一个函数‘。似乎它没有加载bashrc/其他init脚本。
UPD2:是的,它不加载bash,但是当我启用bash时,它会变得更糟。作为一种临时解决方案,我禁用了capistrano/assets。看来我只需要擦掉粘贴的卡皮斯特拉诺脚本,然后从头开始重写它。
发布于 2013-07-23 06:32:01
当Capistrano登录时-它使用非交互式shell -它不加载.bash_profile,因此,我已经在deployment.rb中加载了一个bash作为默认的shell。
default_run_options[:shell] = '/bin/bash'然后将RVM加载脚本从.bash_profile移动到.bashrc
#.bash_profile
source ~/.bashrc
#.bashrc
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*https://stackoverflow.com/questions/17782394
复制相似问题