第一步:下载
官网:https://nodejs.org/zh-cn/download/
第二步:配置环境变量
在想要安装的目录下创建两个文件node_global node_cache
执行命令
npm config set prefix “D:\Program\NodeJS\node_global”
npm config set cache “D:\Program\NodeJS\node_cache”
或编辑
npm.npmrc
prefix = “D:\Programme\NodeJS\node_global”
cache = “D:\Programme\NodeJS\node_cache”
编辑环境变量
path:node_global路径
NODE_PATH:node_global\node_modules路径
查看node配置信息
npm config list
设置npm源为淘宝镜像源
npm config set registry https://registry.npm.taobao.org
验证
npm config get registry