npm and cnpm difference

NPM introduced:

  1. Description: NPM (Node Package Manager) is a NodeJS package manager, a node widget management (including installing, uninstalling, management dependence)
  2. NPM installation using plug-ins: Command Prompt execution npm install <name> [-g] [--save-dev] 
    <name>: Node plug-in name. 
    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: positioning will be installed in the current directory; global installed through the command line anywhere to call it, will be installed locally installed in node_modules locate the file directory folder, by requiring () call;
  4. --save: To save the package.json (of package.json yes NodeJS project configuration file)
  5. -dev;: Save the devDependencies package.json to the node is not specified to the dependent node to save -dev

Why do you want to save to the 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 according package.json download all the required packages).

 

6. npm uninstall the plug: npm uninstall <name> [-g] [--save-dev]

7. Update npm widget: npm update <name> [-g] [--save-dev]

8. Update All widget: npm update [--save-dev] 

9. Check NPM Help: NPM Help 

10. Review 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.

 

 

CNPM description:

  1. Note: Because the Google Plug foreign downloaded from the server, by the big network effects may appear abnormal, if Google's servers in China is like, so we are happy to share Taobao team did this thing come from the official website: "This is a complete npmjs.org mirror, 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. "
  2. Official Website: http://npm.taobao.org
  3. Installation: Execute the command promptnpm install cnpm -g --registry=https://registry.npm.taobao.org
  4. Note: After installation is best viewed its version cnpm -v or close the command prompt reopened, installing direct use of an error may occur 

Note: CNPM fully consistent with NPM usage, but when executing commands Google changed CNPM.

 

source:

Jancy1072's blog https: //blog.csdn.net/shelly1072/article/details/51524029

Guess you like

Origin www.cnblogs.com/HDWdemo/p/12028664.html