未找到错误:在 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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:01:00  来源:igfitidea点击:

Error not found: git when install npm package on windows

gitnpmwindow

提问by Adam

I'm trying to install this package through npm npm install bigwheelon 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\cmdand append this to your PATHvariable in environment variables.

请找到您机器上的哪个位置安装了 git。例如C:\Program Files\Git\cmd并将其附加到PATH环境变量中的变量中。

To append to path please follow below steps:

要附加到路径,请按照以下步骤操作:

  1. Right click on This PCor My Computer& select Properties
  2. Select Advanced System Settings
  3. Select Environment Variables
  4. In System Variableslocate PATHvariable
  5. Select Editand append this path
  6. Click OK& restart command prompt
  1. 右键单击此电脑我的电脑并选择属性
  2. 选择高级系统设置
  3. 选择环境变量
  4. 系统变量中找到PATH变量
  5. 选择编辑并附加此路径
  6. 单击确定并重新启动命令提示符

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 为我解决了问题