Why is sudo: bundle command not found?

后端 未结 4 1381
逝去的感伤
逝去的感伤 2020-12-14 22:14

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: c         


        
4条回答
  •  悲&欢浪女
    2020-12-14 22:51

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

提交回复
热议问题