The difference cnpm and npm

Original Address: https: //blog.csdn.net/chi1130/article/details/72773278

npm Introduction

Description: npm (node package manager) is nodejs package manager for plug-in management node (including installing, uninstalling, management dependence)
NPM installation plug: command prompt npm install [-g] [-save- dev ]
: the Node plug-in name.
Example: the install GULP-NPM-dev less -save
-g: Global installation.
Will be installed in C: \ Users \ Administrator \ AppData \ Roaming \ npm, and write system environment variables; non-global installation: positioning will be installed in the current directory; global installed can call it from anywhere via the command line, installed locally node_modules locate files will be installed in the directory folder, () calls via require;

-save: Save the configuration information to package.json (package.json is nodejs project profiles);

-dev: Save to devDependencies package.json the node is not saved to the specified dependencies -dev node;

Why save to package.json? Because node plug-in package is very large, relatively speaking, it is not added to version management, configuration information is written and added package.json version management, other developers can download the corresponding (command prompt execution npm install, it will be based on package .json download all the required packages).
3. npm uninstall the plug: npm Uninstall [-g] [-save-dev]
the PS: Do not delete local widget package
4. npm widget update: Update npm [-g] [-save-dev]
5. The Update All plug: npm Update [-save-dev]
6. View npm help: help npm
7. View the current directory has been installed plug-ins: npm list

PS: npm install plug process: from http://registry.npmjs.org download the corresponding plug-in package (the server is located abroad, it is often slow to download or abnormal), the solution ↓↓↓↓↓↓ look down.
Optional cnpm

Description: Since npm install the plug-in is downloaded from the server abroad, by the impact of a large network, exceptions may occur if the server npm like in China, so we are happy to share Taobao team did this thing. From the official website: "This is a complete npmjs.org image, you can use this instead of the official version (read-only), synchronous frequency of the current 10 minutes to ensure as far as possible be synchronized with the official service."
Official Website: http: // npm. taobao.org
installation: command prompt implementation of npm install cnpm -g -registry = https: //registry.npm.taobao.org
Note: after installation is best viewed its version number cnpm -v or close the command prompt re-open, installing directly there may be errors
Note: cnpm fully consistent with npm usage, but when executing the command npm changed cnpm.

Please feel free to reprint the original article. Willing to share, and progress together. - Jiang coder

Guess you like

Origin www.cnblogs.com/superclound/p/11247595.html