Rijo
Rijo

Reputation: 3043

How does git relate with npm? | npm ERR! Failed using git. | material.angular.io

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.

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.

Upvotes: 2

Views: 1592

Answers (2)

VonC
VonC

Reputation: 1325437

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

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

  • a simplified PATH

     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%
    
  • a PATH completed with the minimum you need

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

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

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

Upvotes: 2

Tarik Moustaid
Tarik Moustaid

Reputation: 9

You simply need to add Git to your PATH env variable.

Upvotes: 1

Related Questions