为什么在使用sudo时找不到命令“ bundle”:
[root@desktop gitlab]# sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production sudo: bundle: command not found [root@desktop gitlab]#
但是在不使用sudo时确实存在:
[root@desktop gitlab]# bundle exec rake gitlab:setup RAILS_ENV=production Warning You are running as user root, we hope you know what you are doing. Things may work/fail for the wrong reasons. For correct results you should run this as user git. This will create the necessary database tables and seed the database. You will lose any previous data stored in the database. Do you want to continue (yes/no)? no Quitting... [root@desktop gitlab]#
我问的原因是我正在关注https://github.com/gitlabhq/gitlab- recipes/tree/master/install/centos,它指出要使用sudo。
所述添加标志…引发’bundle:命令未找到’错误,但显示“此帐户当前不可用”。
PATH使用和不检查的值是否相同sudo。显然,找不到bundle它是因为它没有在PATH
PATH
sudo
bundle
您可以比较以下两行的输出
$ echo 'echo $PATH' | sh $ echo 'echo $PATH' | sudo sh
理想情况下sudo,应该PATH保持不变。但这可能是托管分发的附带问题。
由原始海报编辑。输出为:
[root@desktop etc]# echo 'echo $PATH' | sh /usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin [root@desktop etc]# echo 'echo $PATH' | sudo sh /sbin:/bin:/usr/sbin:/usr/bin:/user/local/bin [root@desktop etc]#