下载 n 包
npm install n -g
使用命令
- 列出已安装的node版本
n
- 使用某个版本
先用命令 n 列出版本后,再通过键盘的上下键来选择对应的版本,回车。
- 下载某个版本
n x.x.x
- 删除某个版本
n rm x.x.x
node版本造成项目上的坑
在安装ant-design-vue-pro后台管理系统的时候,就遇到过这样非常依赖node版本的问题。
项目所有的包通过yarn都安装好了,然后 yarn run serve运行不起来。报这样的错误
node:internal/crypto/hash:71 this[kHandle] = new _Hash(algorithm, xofLen);
通过网上找答案,说是node版本过高,然而我的版本是19.1.0,后来我通过n包管理器安装16.19.0版本后,项目果然跑起来了。