npm means "node package manager" in Chinese. It is the default package management tool of the Node.js platform. It will be installed together with Nodejs. npm manages third-party plug-ins corresponding to node.js; you can install, share, and distribute code through npm. , manage node project dependencies.
The operating environment of this tutorial: Windows 7 system, nodejs version 12.19.0, DELL G3 computer.
What is npm? What does it have to do with node.js?
npm (full name Node Package Manager, "node package manager") is Nodejs's default software package management system written in JavaScript. npm can be used to install, share, distribute code, and manage project dependencies.
npm is the package management tool in the JavaScript world and the default package management tool for the Node.js platform, which will be installed along with Nodejs. Similar to maven, gradle in Java syntax, and pip in python.
npm can solve many problems in NodeJS code deployment. Common usage scenarios include the following:
Allow users to download third-party packages written by others from the NPM server for local use.
Allows users to download and install command line programs written by others from the NPM server for local use.
Allows users to upload packages or command line programs they write to the NPM server for others to use.
npm coexists with Nodejs. As long as Nodejs is installed, npm will also be installed. After Nodejs is installed. Open the terminal and execute the following command to check whether the installation is successful.
Extended knowledge: What happens when running npm run xxx
When running npm run xxx, npm will first search for the program to be executed in node_modules/.bin in the current directory, and run it if found;
If not found, search from the global node_modules/.bin. npm i -g xxx will install it to the global directory;
If the global directory is still not found, then check the path environment variable to see if there are other executable programs with the same name.