简体   繁体   English

Bower:ENOGIT Git 未安装或不在 PATH 中

[英]Bower: ENOGIT Git is not installed or not in the PATH

Git is installed and is in the path. Git 已安装并在路径中。

Platform: Red Hat Enterprise Linux 5.8.平台:红帽企业 Linux 5.8。

>which git
/usr/local/bin/git

Yet bower can't find it:然而凉亭找不到它:

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

What is the recommended work-around?推荐的解决方法是什么?

Adding Git to Windows 7/8/8.1 Path将 Git 添加到 Windows 7/8/8.1 路径

Note: You must have msysgit installed on your machine.注意:您的机器上必须安装msysgit Also, the path to my Git installation is "C:\Program Files (x86)\Git".另外,我的 Git 安装路径是“C:\Program Files (x86)\Git”。 Yours might be different.你的可能不一样。 Please check where yours is before continuing.请在继续之前检查您的位置。

Open the Windows Environment Variables/Path Window.打开 Windows 环境变量/路径窗口。

  1. Right-click on My Computer -> Properties右键单击我的电脑->属性
  2. Click Advanced System Settings link from the left side column单击左侧栏中的高级系统设置链接
  3. Click Environment Variables in the bottom of the window单击窗口底部的环境变量
  4. Then under System Variables look for the path variable and click edit然后在系统变量下查找路径变量并单击编辑
  5. Add the pwd to Git's binary and cmd at the end of the string like this:将 pwd 添加到 Git 的二进制文件中,并在字符串末尾添加 cmd,如下所示:

     ;%PROGRAMFILES(x86)%\Git\bin;%PROGRAMFILES(x86)%\Git\cmd

Now test it out in PowerShell.现在在 PowerShell 中进行测试。 Type git and see if it recognizes the command.键入git并查看它是否识别该命令。

这是向您展示如何操作的图像!

Source: Adding Git to Windows 7 Path来源: 将 Git 添加到 Windows 7 路径

只需使用 Git Bash 而不是 cmd。

Run the following command at your node.js command prompt where "<git path>" is the path to your git bin folder:在 node.js 命令提示符处运行以下命令,其中“<git path>”是 git bin 文件夹的路径:

set PATH=%PATH%;<git path>;

So, like this:所以,像这样:

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

Or this: (Notice the (x86) )或者这个:(注意 (x86) )

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

This will add git to your path variables.这会将 git 添加到您的路径变量中。 Be sure you type it correctly or you could possibly delete your path vars which would be bad.确保你输入正确,否则你可能会删除你的路径变量,这会很糟糕。

Make sure you installed Git with the second or third option selected from the list.确保安装 Git 时选择了列表中的第二个或第三个选项。 It will penetrate the Git command to cmd by modifying PATH automatically ;)它将通过自动修改 PATH 将 Git 命令渗透到 cmd ;)

在此处输入图像描述

I had the same error in Windows.我在 Windows 中遇到了同样的错误。 Adding git to the path fixed the issue.将 git 添加到路径解决了这个问题。

G:\Dropbox\Development\xampp\htdocs.penfolds.git\penfolds-atg-development>bower install
bower bootstrap#~3.0.0          ENOGIT git is not installed or not in the PATH

G:\>PATH
PATH=E:\Program Files\Windows Resource Kits\Tools\;

G:\Dropbox\Development\xampp\htdocs.penfolds.git\penfolds-atg-development>set PATH=%PATH%;E:\Program Files\Git\bin;

G:\Dropbox\Development\xampp\htdocs.penfolds.git\penfolds-atg-development>bower install
bower bootstrap#~3.0.0      not-cached git://github.com/twbs/bootstrap.git#~3.0.0
bower bootstrap#~3.0.0         resolve git://github.com/twbs/bootstrap.git#~3.0.0

I am also getting the same error and the solution is first to check if the Git is installed or not in the system and if not please install it.我也遇到同样的错误,解决方法是首先检查系统中是否安装了Git ,如果没有,请安装它。

After installation, open Git Bash or Git Shell from Windows and go to your project (same way you go in command prompt using "cd path").安装后,从 Windows 打开Git BashGit Shell并转到您的项目(与使用“cd path”进入命令提示符的方式相同)。 Git Shell is installed by default with Github windows installation. Git Shell默认随Github windows 安装一起安装。

Then run the same bower install command.然后运行相同的bower install命令。 It will work as expected.它将按预期工作。

The below screenshot shows the command using Git Shell下面的屏幕截图显示了使用Git Shell的命令使用 Git Shell 安装 Bower

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

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

When you ran the git install, you probably didn't choose:当你运行 git install 时,你可能没有选择:

"Use Git from the Windows Command Prompts" “从 Windows 命令提示符中使用 Git”

during the installation.在安装过程中。

Re-run git install, and choose that option.重新运行 git install,然后选择该选项。

You are missing the ENVIRONMENT PATH.您缺少环境路径。 Follow these steps:按着这些次序:

  1. Search for 'Edit the system environment variables'.搜索“编辑系统环境变量”。
  2. Click on 'Environment Variables'.单击“环境变量”。
  3. In the 'System variables' section, scroll down and click on the variable 'Path'.在“系统变量”部分,向下滚动并单击变量“路径”。 Click 'Edit'.点击“编辑”。
  4. Append this text to the end of the 'Variable value'.将此文本附加到“变量值”的末尾。

;%PROGRAMFILES%\Git\bin;%PROGRAMFILES%\Git\cmd ;%PROGRAMFILES%\Git\bin;%PROGRAMFILES%\Git\cmd

I also got the same problem from cmd and resolved using the following steps.我也从 cmd 得到了同样的问题,并使用以下步骤解决了。

First install the https://msysgit.github.io/ (if not alredy installed).首先安装https://msysgit.github.io/ (如果尚未安装)。 Then set the Git path as suggested by skinneejoe:然后按照 skinneejoe 的建议设置 Git 路径:

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

Or this (notice the (x86)):或者这个(注意(x86)):

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

In Linux:在 Linux 中:

if you dont have installed git use:如果你没有安装 git 使用:

sudo apt-get update
sudo apt-get install git

with command which git you will know the directory where is and then add in path if it is not in that enviroment variable.使用which git命令,您将知道目录在哪里,如果它不在该环境变量中,则添加路径。

I bumped into this problem on a cPanel CentOS 6 linux machine.我在 cPanel CentOS 6 linux 机器上遇到了这个问题。 The solution for me was to symlink the cPanel git to /usr/local/bin/git我的解决方案是将 cPanel git 符号链接到/usr/local/bin/git

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

1.Set the Path of Git in environment variables. 1.在环境变量中设置Git的路径。 2.From Windows command prompt, run cd Project\folder\Path\ run the command: bower install 2.在 Windows 命令提示符下,运行 cd Project\folder\Path\ 运行命令: bower install

People above already gave solutions for your proplem, I hope so.上面的人已经为您的问题提供了解决方案,我希望如此。 If someone is facing this issue in 2022 in using docker images, then you should add a command to install git in your image.如果有人在 2022 年在使用 docker 映像时遇到此问题,那么您应该添加一个命令以在您的映像中安装 git。

For Example you are using alpine image in your Dockerfile .例如,您在Dockerfile中使用高山图像。 Then it will be something like this:然后它会是这样的:


FROM node:8.3-alpine

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

RUN apk add git


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

I solved the problem by install Git Bash from Download Git Bash .我通过从Download Git Bash安装 Git Bash 解决了这个问题。

Setting this option 3 when installing the software as shown bellow.安装软件时设置此选项 3,如下图所示。

设置路径变量

Finally select the project folder by right click using Bash as shown below.最后使用 Bash 右键单击​​选择项目文件夹,如下所示。

在此处输入图像描述

and type并输入

npm install npm 安装

. . It works for me.这个对我有用。

npm install from git bash did work for me.来自git bashnpm install对我有用。 After rebooting PC.重启电脑后。

Just use the Git Bash instead of node.js or command prompt只需使用 Git Bash 而不是 node.js 或命令提示符

As an Example for installing ReactJS, after opening Git Bash, execute the following command to install react:以安装 ReactJS 为例,打开 Git Bash 后,执行以下命令安装 react:

bower install --react

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM