在windows环境下纯zip包方式安装VSCode和Node.js(含npm)
1.在官网下载VSCode和Node.js的zip包
Nodejs已经中包含npm
https://code.visualstudio.com/Download
https://nodejs.org/zh-cn/download/
2.解压
例如解压目录为G:\node.js\
3.配置
新建目录node_global、node_cache
npm config set prefix "G:\node.js\node-v14.15.4-win-x64\node_global"
npm config set cache "G:\node.js\node-v14.15.4-win-x64\node_cache"
4.环境变量
新增环境变量
NODE_PATH=G:\node.js\node-v14.15.4-win-x64\node_modules\
Path中新增
G:\node.js\node-v14.15.4-win-x64\node_modules\或%NODE_PATH%
G:\node.js\node-v14.15.4-win-x64\node_global\
检查node和npm是否安装成功
在命令行中输入
node -v
npm -v
5.配置镜像源
搭建环境时通过如下代码将npm设置成淘宝镜像
npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist --global
查看镜像的配置结果
【默认镜像仓库registry:https://registry.npmjs.org/】
【默认disturl:undefined】
npm config get registry
npm config get disturl