What does npm intall actually do?
EditLately I am diving into the nodejs world. I would said it's my bet on the future of programming, JS will rule the world (fingercrossed). So back to the topic of this post, while I was cloning different nodejs project from git, I notice everyone is using "npm install", and I am curious of what does "npm intall" actually do, first I ask some colleagues who worked closely with nodejs, but I cannot find a satisfying answer. Therefore, I asked the ultimate expert "Google", what I got is really informative and help me understand how "npm install" work.
In short (as said in the npm install doc):
By default,
npm install
will install all modules listed as dependencies inpackage.json
Yet, npm install could install from many other location / file other than the package.json in the root folder of your project.
A
package
is:- a) a folder containing a program described by a
package.json
file - b) a gzipped tarball containing (a)
- c) a url that resolves to (b)
- d) a
<name>@<version>
that is published on the registry (seenpm-registry
) with (c) - e) a
<name>@<tag>
(seenpm-dist-tag
) that points to (d) - f) a
<name>
that has a "latest" tag satisfying (e) - g) a
<git remote url>
that resolves to (a)
You can read more by going to install | npm Documentation
What does npm intall actually do?
Reviewed by DF
on
9:14:00 PM
Rating: