Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 为什么找不到sudo:bundle命令?_Ruby_Linux_Rubygems_Bundler_Sudo - Fatal编程技术网

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

Ruby 为什么找不到sudo:bundle命令?,ruby,linux,rubygems,bundler,sudo,Ruby,Linux,Rubygems,Bundler,Sudo,为什么在使用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]# [root@desktop gitlab]# bundle exec rake gitlab:setup RAILS_ENV=production Warn

为什么在使用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]#
[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]#
但不使用sudo时不存在:

[root@desktop gitlab]# sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
sudo: bundle: command not found
[root@desktop gitlab]#
[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]#
我问的原因是我在跟踪,并且它声明使用sudo


我已尝试添加一个如所述的
-I
标志,但得到“此帐户当前不可用”。

检查
路径是否具有与不具有
sudo
的相同值。显然,它找不到
捆绑包
,因为它没有列在
路径中

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

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

用户是在没有bash登录shell的情况下创建的。在centos中使用系统配置用户更改此设置。然后将git放入/home/git并移动到gitlab目录。执行不带sudo标记的bundle命令。您将遇到的下一个错误是config dir中缺少database.yml。使用正确的密码修复此问题(即复制mysql或postgres示例并编辑)。

尝试:

sudo-u git-H env PATH=$PATH&&bundle-exec-rake-gitlab:check-RAILS\u env=production


要使用与当前用户相同的
路径

我遇到了这个问题,我认为我的gitlab是从源代码处安装的,并且我得到了相同的错误。但在尝试了备份的综合方法后,我的问题解决了 使用此命令:

sudo gitlab rake gitlab:备份:创建


我最近在Gentoo box上安装了Gitlab,发现git用户需要一个有效的shell和主目录才能成功安装。显然,Gitlab源代码上有一个commit,它淘汰了这个版本,但它还不是发布的Gitlab版本的一部分。我有完全相同的问题,只是在安装gem的命令中遇到了错误:“sudo-u git-H bundle install--deployment--without development test mysql aws”。我正在运行Ubuntu12.04服务器。可能的副本请参见下面:
[root@desktopgitlab]#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@desktopgitlab]| echo'echo$PATH'| sudo sh/sbin:/bin:/usr/sbin:/usr/bin:/user/local/bin[root@desktopgitlab]#
尝试在您的
.bashrc
中添加以下内容:
别名sudo='sudo env PATH=$PATH'
然后在新的bash会话中重新运行所有命令,现在它们应该可以工作了:)希望如此,如果您仍然面临问题,请告诉我Hanks deimus。将该行添加到
/etc/bashrc
的第一行,但没有更改。尝试注销并重新登录,但仍然没有。请注意,
/etc/bashrc
声明“除非您知道自己在做什么,否则更改此文件不是一个好主意…”。我应该担心吗?