1、首先我们使用nvm来管理node版本
nvm下载安装地址:Releases · coreybutler/nvm-windows · GitHub
2、安装node,我们以node的14.17.3版本为例
nvm install 14.17.3
附nvm常用命令:
nvm install:安装指定版本node,如nvm install 14.17.3
nvm uninstall:卸载指定版本node,如nvm uninstall 14.17.3
nvm list:列出已安装node版本
nvm on:启用node版本管理
nvm off:禁用node版本管理
nvm use:切换/使用指定node版本,前提是安装了相应版本,如nvm use 14.17.3
nvm -v:查看当前nvm版本
nvm node_mirror:设置节点镜像,如nvm node_mirror CNPM Binaries Mirror
nvm npm_mirror:设置npm镜像,如nvm npm_mirror CNPM Binaries Mirror
3、nvm 安装node之后使用
nvm use 14.17.3
查询node版本
node -v
查询npm版本
npm -v
4、至此node就已经安装完成,npm默认使用国外镜像,速度会很慢,我们可以配置成国内淘宝镜像
npm config set registry https://registry.npm.taobao.org
查询当前npm镜像地址:npm config get registry,镜像配置成功后,返回的是上面配置的地址
备注:如需要使用cnpm或者yarn等命令请自行安装即可