npm commands in node

First introduce 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).

The main functions are these

  1. Allows users to download third-party packages written by others from the NPM server for local use.
  2. Allows users to download and install command-line programs written by others from the NPM server for local use.
  3. Allows users to upload their own packages or command-line programs to the NPM server for others to use.

Now list some npm commands

  1. It can detect whether the installation is successful node and node -v have the same effect

npm -v

  1. Commands for using Taobao Mirror

npm install -g cnpm --registry=https://registry.npmmirror.com

  1. Install Node.js module syntax format

npm install
where install is equivalent to add, i, in, ins, inst, insta, instal, isnt, isnta, isntal

  1. Local installation and global installation (take jquery as an example)

npm i jquery
npm i jquery -g

  1. View all globally installed modules

npm list -g

  1. Check the version number of a module

npm list grunt

  1. Uninstall the module (take jquery as an example)

npm uninstall jquery
where uninstall is equivalent to unlink, remove, rm, r, un

  1. Check if the package exists

npm ls

  1. Update module (take jquery as an example)

npm update jquery

  1. Explore modules (take jquery as an example)

npm search jquery

  1. View historical versions (take jquery as an example)

npm view jquery versions

Supplement
View the global installation directory

npm root view -g

Both during development and on-line development

npm i jquery -D
npm i jquery -S

Install the specified version

npm i pkg@version

The last important thing is to view the command help

npm help

That concludes the summary here, see you next time!!!

Guess you like

Origin blog.csdn.net/weixin_48466991/article/details/126840015