1. What is npm
The full name of NPM is Node Package Manager , which is a NodeJS package management and distribution tool , and has become an unofficial standard for releasing Node modules (packages).
Two, npm use
1. Initialize npm
- npm init
- npm init -y quick initialization project
2. Catalog Explanation
- package.json project package management file
- package-lock.json download cache address
The location where the node_modules installation package is downloaded
3. Install install
(1) Ordinary installation
Example: Install jquery npm install jquery
(2 ) Global installation
Example: Install vue globally npm i @vue/cli -g
(3) Install a fixed version
Example: Install fixed version 2.1 of jquery npm i [email protected] -S
4. Uninstall uninstall
Example: Uninstall jquery npm uninstall jquery
5. View the location of the global installation of the plug-in
npm root view -g
6. Version number XYZ
- X major version, the upgrade of X is incompatible 3.6.0->4.0.1 is not compatible, the project using 3.6.0 is incompatible with the current 4.0.1 project;
- The version in Y, the upgrade of Y means that there is a new content addition (compatible);
- Z minor releases usually fix bugs.
7. update update
Example: update jquery npm update jquery