npm set taobao source

npm 设置淘宝镜像源

# 安装时临时指定代理
npm --registry=https://registry.npm.taobao.org install

# 全局配置
npm config set registry https://registry.npm.taobao.org

# 删除
npm config delete registry
# or
npm config edit
# 找到:registry=https://registry.npm.taobao.org/ 删除

# 查看镜像地址
npm get registry

使用 cnpm

支持 gzip 压缩,可代替默认的 npm

# 安装
npm install -g cnpm --registry=https://registry.npm.taobao.org

# 安装模块
cnpm install [name]

# 同步模块,直接通过 sync 命令马上同步一个模块, 只有 cnpm 命令行才有此功能:
cnpm sync connect
# or 通过 web 方式
open https://npm.taobao.org/sync/connect

node-sass 源

npm install -g mirror-config-china --registry=http://registry.npm.taobao.org

安装或删除依赖

# 只下载到 node_modules 目录,不改变 package.json
npm install jquery
npm uninstall/remove jquery

# 参数,会改变 package.json
-S, –save:dependencies
-D, –save-dev:devDependencies
-O, –save-optional:optionalDependencies

https://developer.aliyun.com/mirror/NPM

原文地址:https://www.cnblogs.com/jhxxb/p/12615087.html