已安装Git并在路径中。

平台:Red Hat Enterprise Linux 5.8。

>which git
/usr/local/bin/git

然而鲍尔却找不到它:

bower angular#1.0.6  ENOGIT git is not installed or not in the PATH

建议的解决方案是什么?


当前回答

上面的人已经为你的问题给出了解决方案,我希望如此。如果有人在2022年使用docker镜像时面临这个问题,那么你应该添加一个命令来在你的镜像中安装git。

例如,您在Dockerfile中使用alpine image。那么它将是这样的:


FROM node:8.3-alpine

# ....... other stuffs .....

RUN apk add git


# ....... other stuffs .....

其他回答

我在一台cPanel CentOS 6 linux机器上遇到了这个问题。 我的解决方案是将cPanel git符号链接到/usr/local/bin/git

ln -s /usr/local/cpanel/3rdparty/bin/git /usr/local/bin/git

在Windows上,您可以尝试在命令提示符处设置路径:

set PATH=%PATH%;C:\Program Files\Git\bin;

上面的人已经为你的问题给出了解决方案,我希望如此。如果有人在2022年使用docker镜像时面临这个问题,那么你应该添加一个命令来在你的镜像中安装git。

例如,您在Dockerfile中使用alpine image。那么它将是这样的:


FROM node:8.3-alpine

# ....... other stuffs .....

RUN apk add git


# ....... other stuffs .....

在Linux中:

如果你没有安装git,请使用:

sudo apt-get update
sudo apt-get install git

使用命令,你将知道目录在哪里,然后添加路径,如果它不在那个环境变量。

我有同样的问题,需要重新启动cmd -问题消失了。