The difference between cnpm and npm

NPM introduction:

  1. Description: NPM (Node Package Manager) is a NodeJS package manager for node plugin management (including installation, uninstallation, dependency management, etc.)
  2. Install the plug-in using NPM: execute npm install [-g] [–save-dev] at the command prompt
    : the name of the node plug-in. Example: npm install gulp-less --save-dev
  3. -g: global installation. Will be installed in C: \ Users \ Administrator \ AppData \ Roaming \ npm, and write system environment variables; non-global installation: will be installed in the current location directory; global installation can be called from anywhere on the command line, local installation will Installed in the node_modules folder of the positioning directory, called by the request ();
  4. –Save: package.json to be saved to (package.json is a NodeJS project configuration file)
  5. -dev ;: DevDependencies node of package.json saved to, without -dev will be saved to dependent nodes

Why should I save the package.json to? Because the node plug-in package is relatively large, so do not join the version management, write the configuration information in the package.json and add it to the version management, other developers can download it accordingly (command prompt execute npm install, it will Download all required packages according to package.json).

  1. Use npm to uninstall the plugin: npm uninstall [-g] [--save-dev]

  2. Update the plugin using npm: npm update [-g] [--save-dev]

  3. Update all plugins: npm update [--save-dev]

  4. View NPM Help: NPM Help

    10. Check the plug-ins installed in the current directory: npm list
    PS: NPM plug-in installation process: download the corresponding plug-in package from http://registry.npmjs.org (the website server is located abroad, so the download is often slow or abnormal), solve Way to look down ↓↓↓↓↓↓.

Introduction of CNPM:

Note: Because Google installs the plug-in to download from a foreign server, it is greatly affected by the network, and it may be abnormal. If the Google server is in China, it will be fine, so the Taobao team we are happy to share did this from the official website: "This is a complete npmjs.org mirror, you can use this instead of the official version (read-only), the synchronization frequency is currently once every 10 minutes to ensure as much as possible to synchronize with the official service. "
Official website: http://npm.taobao.org
installation: Command prompt execute npm install cnpm -g --registry = https: //registry.npm.taobao.org
Note: It is best to check its version after installation cnpm- v or close the command prompt and reopen it. After installation, you may use an error directly.
Note: CNPM and NPM usage are exactly the same, but Google is changed to CNPM when executing the command.

Published 8 original articles · Likes2 · Visits 490

Guess you like

Origin blog.csdn.net/qq_42003546/article/details/102741283