cambraca
cambraca

Reputation: 27839

In npm, how are git dependencies cloned?

When you have a git+ssh:// dependency in a package.json, what actually happens when you run npm install? Does it:

a) Use the git command from the OS to clone the repo? (I think this is unlikely)

b) Somehow download the files using Node APIs, without actually cloning the repo?

Bonus: how can I find the code (I assume in the NPM project) that does this?

Upvotes: 0

Views: 31

Answers (1)

Mr.
Mr.

Reputation: 10102

npm uses git command of your os, you can see it by running npm doctor

and here is a reference in the code

which git

While it’s documented in the README, it may not be obvious that npm needs Git installed to do many of the things that it does. Also, in some cases – especially on Windows – you may have Git set up in such a way that it’s not accessible via your PATH so that npm can find it. This check ensures that Git is available.

Upvotes: 1

Related Questions