Linux   发布时间:2022-04-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了linux – Capistrano部署的精神错误大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我有一个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_profile
source ~/.bashrc



#.bashrc
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a sHell session *as a function*

大佬总结

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

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

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。