未找到错误:在 Windows 上安装 npm 包时出现 git
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44388889/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error not found: git when install npm package on windows
提问by Adam
I'm trying to install this package through npm npm install bigwheel
on windows using webstorm IDE.
我正在尝试npm install bigwheel
使用 webstorm IDE通过Windows 上的npm 安装此软件包。
I'm getting
我越来越
"Error: not found: git" "This is most likely not a problme with npm itself. Please check if you have git installed and in yout Path"
“错误:未找到:git”“这很可能不是 npm 本身的问题。请检查您是否安装了 git 并在您的路径中”
I have https://git-for-windows.github.io/installed, how do i check the path and fix this error?
我已安装https://git-for-windows.github.io/,如何检查路径并修复此错误?
回答by kk.
Please find at which location on your machine git is installed. e.g. C:\Program Files\Git\cmd
and append this to your PATH
variable in environment variables.
请找到您机器上的哪个位置安装了 git。例如C:\Program Files\Git\cmd
并将其附加到PATH
环境变量中的变量中。
To append to path please follow below steps:
要附加到路径,请按照以下步骤操作:
- Right click on This PCor My Computer& select Properties
- Select Advanced System Settings
- Select Environment Variables
- In System Variableslocate PATHvariable
- Select Editand append this path
- Click OK& restart command prompt
- 右键单击此电脑或我的电脑并选择属性
- 选择高级系统设置
- 选择环境变量
- 在系统变量中找到PATH变量
- 选择编辑并附加此路径
- 单击确定并重新启动命令提示符
Execute below command from new command prompt after appending this:
附加此后,从新命令提示符执行以下命令:
git --version
It should display something like:
它应该显示如下内容:
git version 2.9.0.windows.1
After following these steps, try to install npm package and see whether the problem is resolved.
按照这些步骤后,尝试安装npm包,看看问题是否解决。
回答by Uday Shivamurthy
In Windows, environment...there are 2 issues here: Installation SourceTree does not mean git.exe is installed, so you need to install latest version first Then go this url (https://github.com/npm/npm/wiki/Troubleshooting) and doing an npm reinstall in the directory where I have my project fixed the problem for me
在Windows中,环境...这里有2个问题:安装SourceTree并不意味着安装了git.exe,所以你需要先安装最新版本然后去这个网址(https://github.com/npm/npm/wiki /Troubleshooting) 并在我的项目所在的目录中重新安装 npm 为我解决了问题