为什么找不到sudo:bundle命令? [英] Why is sudo: bundle command not found?

查看:1298
本文介绍了为什么找不到sudo:bundle命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么在使用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 
警告
您以root用户身份运行,我们希望您知道您在做什么。
由于错误的原因,事情可能会奏效/失败。
为了获得正确的结果,您应该以用户git身份运行。

这将创建必要的数据库表并为数据库创建种子。
您将失去以前存储在数据库中的任何数据。
是否要继续(是/否)? no
退出...
[root @ desktop gitlab]#

我问的原因是我遵循 https://github.com/gitlabhq / gitlab-recipes / tree / master / install / centos ,并声明使用sudo。



我试着添加 -i 标志,如使用$ sudo bundle exec ...引发'bundle:command not found'错误,但得到此帐户当前不可用。。

解决方案

检查 PATH 的值是否与 sudo 。显然,它找不到 bundle ,仅仅因为它没有列在 PATH中



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

  $ echo'echo $ PATH'| sh 
$ echo'echo $ PATH'| sudo sh

最好是 sudo 应该离开 PATH 不变。但这可能是您的主机发行版的一个侧面问题。



按原始海报编辑。输出是:

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


Why is command "bundle" not found when using sudo:

[root@desktop gitlab]# sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
sudo: bundle: command not found
[root@desktop gitlab]#

but does exist when not using 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]#

The reason I ask is I am following https://github.com/gitlabhq/gitlab-recipes/tree/master/install/centos, and it states to use sudo.

I've tried adding a -i flag as described by Using $ sudo bundle exec ... raises 'bundle: command not found' error, but get "This account is currently not available.".

解决方案

Check if the PATH has the same values both with and without sudo. Apparently it cannot find bundle just because it is not listed in PATH

You can compare the outputs of following two lines

$ echo 'echo $PATH' | sh
$ echo 'echo $PATH' | sudo sh

Ideally sudo is supposed to leave PATH untouched. But this might be a side issue of your hosting distribution.

Edit by original poster. Output is:

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

这篇关于为什么找不到sudo:bundle命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆