Common Node Commands

  • View the NPM command
npm help
Copy the code
  • Installation module (package) :
// Global install NPM install module name -g // Local install NPM install module name // Install multiple NPM install modules 1 module 2 module n --save // Install depends on NPM install module name when run --save or NPM install -s NPM install --save-devCopy the code
  • View the installation directory:
Check the local installation directory NPM root // Check the global installation directory NPM root -gCopy the code
  • Uninstalling modules (packages) :
// Uninstall local module NPM uninstall Module name // Uninstall global module NPM uninstall-g module nameCopy the code
  • Update modules (packages) :
NPM update Module name NPM update module name -gCopy the code
  • View the currently installed modules (packages) :
npm ls
npm ls -g
npm list -g --depth 0
Copy the code
  • View information about modules (packages) :
NPM info Module nameCopy the code

Image source

Using a configuration

npm config setRegistry Indicates the source address of the imageCopy the code

cnpm

NPM install -g CNPM --registry= source address of the image // Use CNPM instead of NPM CNPM installCopy the code

The use of NRM

// Install the NRM tool NPM install -g NRM // View the available image source NRM ls // Switch the NPM source NRM use the image source nameCopy the code