linux – Capistrano部署的精神错误

linux – Capistrano部署的精神错误,第1张

概述我有一个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 (P 我有一个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并假设这个警告实际上是心理崩溃的原因.但我无法摆脱它,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

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

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

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

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

解决方法 当CAPIstrano登录时 – 它使用非交互式shell – 它不会加载.bash_profile
所以,我在deployment.rb中加载了一个bash作为默认shell:

default_run_options[:shell] = '/bin/bash'

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

#.bash_profilesource ~/.bashrc#.bashrc[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
@H_403_52@ 总结

以上是内存溢出为你收集整理的linux – Capistrano部署的精神错误全部内容,希望文章能够帮你解决linux – Capistrano部署的精神错误所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/1029521.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存