git 与 npm 有什么关系?|npm 错误!使用 git 失败.|material.angular.io [英] How does git relate with npm? | npm ERR! Failed using git. | material.angular.io

查看:60
本文介绍了git 与 npm 有什么关系?|npm 错误!使用 git 失败.|material.angular.io的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Angular 4 cli,我运行此命令来安装 Angular Material (npm install --save angular/material2-builds angular/cdk-builds) 但它显示如下错误:>

Angular 4 cli, I run this command to install Angular Material (npm install --save angular/material2-builds angular/cdk-builds) but it is showing an error as followS:

    npm ERR! No git binary found in $PATH
    npm ERR!
    npm ERR! Failed using git.
    npm ERR! Please check if you have git installed and in your PATH.

对于这种情况,我必须在我的 PC 上安装 git 或者 git 与 npm 有什么关系?我该如何解决这个问题?无论如何,谢谢大家.

For this scenario, I have to install git in my PC or how is git related to npm? How can I solve this issue? Anyway thanks to everyone.

推荐答案

我更喜欢使用 便携式 Git(例如 PortableGit-2.14.2-64-bit.7z.exe) 我在任何我想要的地方解压.

I prefer to use a portable Git (like PortableGit-2.14.2-64-bit.7z.exe) I have uncompressed anywhere I want.

然后我编写了一个小的 senv.bat 脚本,它将为我设置我需要的最小路径,即:

Then I write a small senv.bat script that will set the PATH for me with the minimum I need, which is:

 set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
 set GH=C:\path\to\git
 set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%PATH%

  • 一个 PATH 以您需要的最低限度完成

  • a PATH completed with the minimum you need

     set PATH=%PATH%;C:\path\to\npm
    

  • 我的问题是为什么我要在我的服务器上安装 git?

    My question is why i want to install git in my server?

    这是官方 npm 文档的一部分:请参阅没有 Git".
    npm 可能需要从远程 Git 存储库克隆依赖项.

    That is part of the official npm documentation: see "No Git".
    npm can need to clone dependencies from remote Git repos.

    这篇关于git 与 npm 有什么关系?|npm 错误!使用 git 失败.|material.angular.io的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆