Saber2pr's Blog

NpmCommonCommands

Use-save for packages that need to be used at run time, otherwise use-save-dev Cnpm install-- save for production environment | | cnpm I-S Cnpm install-- save-dev for development environment | | cnpm I-D

Install the project dependency package

  1. Install to the node_modules directory
npm install [package]

npm i [package]

npm i [package] --registry=https://registry.npmjs.org

two。 Install the package to the node_modules directory Package will be added under the dependencies attribute of package.json

npm install --save [package]
  1. Install the package into the node_modules directory Package will be added under the devDependencies attribute of package.json
npm install --save-dev [package]
  1. Global installation of package
npm install -g [package]

Delete dependency package

npm uninstall xxx

Delete a global module

npm uninstall -g xxx

Delete published npm packages

npx force-unpublish <packageName> 'message'

View Global Modul

npm list -g --depth 0

View the package remote library

npm config get registry

Set up remote library

npm config set registry url

[npm] https://registry.npmjs.org/ [cnpm] https://registry.npm.taobao.org