为什么找不到sudo:bundle命令?

user1032531:

为什么在使用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。

我尝试-i按照使用$ sudo bundle exec所述添加标志...引发'bundle:命令未找到'错误,但是得到“此帐户当前不可用”。

dEIM;

PATH使用和不检查的值是否相同sudo显然,找不到bundle它是因为它没有在PATH

您可以比较以下两行的输出

$ 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]#

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章