1. Top-level usage1. Install cnpmnpm i -g cnpm --registry=https://registry.npm.taobao.org 2. Then you can install the dependent packages with cnpmcnpm i -g vue vue-cli 3. Check with cnpm config lsE:\My Project\2018-08>cnpm config ls ; cli configs disturl = "https://npm.taobao.org/mirrors/node" metrics-registry = "https://registry.npm.taobao.org/" registry = "https://registry.npm.taobao.org/" scope = "" user-agent = "npm/6.3.0 node/v8.11.3 win32 x64" userconfig = "C:\\Users\\Administrator\\.cnpmrc" ; node bin location = D:\Program Files\nodejs\node.exe ; cwd = E:\My Project\2018-08 ; HOME = C:\Users\Administrator ; "npm config ls -l" to show all defaults. E:\My Project\2018-08> You will find that the registry has become a Taobao mirror (warehouse): https://registry.npm.taobao.org/ [The "mirror" in this article is equivalent to the "warehouse", the same below] 2. Original npm1. View the original configuration npm config lsE:\My Project\2018-08>npm config ls ; cli configs metrics-registry = "https://registry.npmjs.org/" scope = "" user-agent = "npm/5.6.0 node/v8.11.3 win32 x64" ; userconfig C:\Users\Administrator\.npmrc cache = "D:\\Program Files\\nodejs\\node_cache" prefix = "D:\\Program Files\\nodejs\\node_global" ; builtin config undefined ; node bin location = D:\Program Files\nodejs\node.exe ; cwd = E:\My Project\2018-08 ; HOME = C:\Users\Administrator ; "npm config ls -l" to show all defaults. E:\My Project\2018-08> You will find that the registry inside is the original image of npm: https://registry.npmjs.org/ 2. npm temporarily uses Taobao mirror to install dependent packagesnpm i -g express --registry https://registry.npm.taobao.org 3. npm uses Taobao mirror to install dependent packagesnpm config set registry https://registry.npm.taobao.org npm i -g express Note that this is not recommended, because it completely sets the npm image to the Taobao image. If some of our dependent packages are only available in the npm original image but not in Taobao, it will be a tragedy. So it is best to separate npm and cnpm. 3. Some common settings1. Check [npm and cnpm are 2 different]npm config ls cnpm config ls 2. Settings: mainly set cache and prefixnpm cofig set cache "D:\Program Files\nodejs\node_cache" npm cofig set prefix "D:\Program Files\nodejs\node_global" cnpm cofig set cache "D:\Program Files\nodejs\node_cache" cnpm cofig set prefix "D:\Program Files\nodejs\node_global" 3. Final ResultE:\My Project\2018-08>cnpm config ls ; cli configs disturl = "https://npm.taobao.org/mirrors/node" metrics-registry = "https://registry.npm.taobao.org/" registry = "https://registry.npm.taobao.org/" scope = "" user-agent = "npm/6.3.0 node/v8.11.3 win32 x64" userconfig = "C:\\Users\\Administrator\\.cnpmrc" ; userconfig C:\Users\Administrator\.cnpmrc cache = "D:\\Program Files\\nodejs\\node_cache" prefix = "D:\\Program Files\\nodejs\\node_global" ; node bin location = D:\Program Files\nodejs\node.exe ; cwd = E:\My Project\2018-08 ; HOME = C:\Users\Administrator ; "npm config ls -l" to show all defaults. E:\My Project\2018-08>npm config ls ; cli configs metrics-registry = "https://registry.npmjs.org/" scope = "" user-agent = "npm/5.6.0 node/v8.11.3 win32 x64" ; userconfig C:\Users\Administrator\.npmrc cache = "D:\\Program Files\\nodejs\\node_cache" prefix = "D:\\Program Files\\nodejs\\node_global" ; builtin config undefined ; node bin location = D:\Program Files\nodejs\node.exe ; cwd = E:\My Project\2018-08 ; HOME = C:\Users\Administrator ; "npm config ls -l" to show all defaults. E:\My Project\2018-08> This is the end of this article about the modification of npm Taobao mirror. For more relevant npm Taobao mirror content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Tutorial on installing MySQL 5.7.28 on CentOS 6.2 (mysql notes)
>>: Graphical tutorial on installing JDK1.8 under CentOS7.4
The execution efficiency of MySQL database has a ...
There are two types of Linux system time. (1) Cal...
Preface In the early stages of some projects, dev...
Docker is equivalent to a container, which can bu...
This article shares the specific code of fabricjs...
Uninstall MySQL 1. In the control panel, uninstal...
Table of contents 1. Forgot the root password and...
Table of contents Overview The role of reverse pr...
<br />Tips for making web table frames. ----...
Preface: This article refers to jackyzm's blo...
Today is another very practical case. Just hearin...
background I talked to my classmates about a boun...
Table of contents 1. Object 1.1 What is an object...
MySQL multi-condition query with AND keyword. In ...
Purpose of using Nginx Using Alibaba Cloud ECS cl...