The process of npm install and npm run

what is npm

npm ( node ​​pakage manage) is a third-party package manager and is the default package management tool for the Node.js platform.

what npm does

Through npm, you can install, share, distribute code, and manage project dependencies.

example:

  • When configuring webpack, many third-party modules (modules occupy a pit) need to be installed through npm install
  • In the actual project work, the project needs to be split if the project is relatively large, but many basic tools, methods and functions can be shared. We can put the public code on the corresponding private library provided by our company, and according to the future For business expansion, as long as the library is updated, and each project is updated with the corresponding version number and reinstalled, the code can be updated synchronously, thereby avoiding repetitive work.

Process of npm inatsll

  • First check whether the node_modules directory exists. If it does not exist (the compressed package under /usr/local/bin on the computer will be checked), then continue with the following operations
  • npm queries the registry for the URL of the module compressed package
  • Download the compressed package and store it in the global corresponding /.npm directory
  • At the same time, unzip it to the node_modules directory of the current project

The difference between several ways of npm install

 npm

The post npm install and npm run process first appeared on Lenix Blog .

This article is reprinted from https://blog.p2hp.com/archives/8692
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment

Your email address will not be published.