use*_*531 11 ruby linux sudo rubygems bundler
为什么使用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]#
Run Code Online (Sandbox Code Playgroud)
但是在不使用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]#
Run Code Online (Sandbox Code Playgroud)
我问的原因是我关注https://github.com/gitlabhq/gitlab-recipes/tree/master/install/centos,并声明要使用sudo.
我尝试添加一个-i
标志,如使用$ sudo bundle exec ...引发'bundle:command not found'错误,但得到"此帐户当前不可用.".
dei*_*mus 19
检查是否PATH
具有相同的值sudo
.显然它找不到bundle
只是因为它没有列出PATH
您可以比较以下两行的输出
$ echo 'echo $PATH' | sh
$ echo 'echo $PATH' | sudo sh
Run Code Online (Sandbox Code Playgroud)
理想情况下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]#
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
19739 次 |
最近记录: |