#Node.js 安装、配置 windows 版
淘宝镜像 8.9.3 (请安装 8.x 版本)
在 nodejs 安装目录或解压目录下 新建 node_global 和 node_cache 两个文件夹
npm config set prefix "nodePath\node_global"
npm config set cache "nodeePath\node_cache"
#查看效果
npm config list
1.解压版 zip
1.1 使用系统变量 系统变量下新建
NODE_HOME=nodeePath
NODE_PREFIX=nodeePath\node_global
NODE_PATH="nodeePath\node_global\node_modules"
1.2 加入 Path
在 Path 中添加 %NODE_HOME%;%NODE_PREFIX%
2.安装版 msi
安装可能会默认把 NODE_HOME 变量加入 Path 中 其他不变
node -v
npm -v
# 查看 npm 配置
npm config ls(list)
# 配置淘宝镜像
npm config set registry https://registry.npm.taobao.org
npm install -g cnpm --registry=https://registry.npm.taobao.org
# 使用 cnpm
cnpm i [name]
yarn 它解决了 npm 的一些缺陷 推荐使用 yarn 替代 npm 进行包管理
# 全局安装
cnpm i -g yarn
# 查看版本
yarn -v
# 查看配置
yarn config list
# 配置淘宝镜像
yarn config set registry https://registry.npm.taobao.org