今天要介紹一個好用的nodejs版本管理工具nvm
一 windows安裝nvm
1.訪問 nvm-windows GitHub 頁面搞疗。
如果你github訪問不好用,也可以去gitee等國內(nèi)倉庫下載
2.下載最新版本的 nvm-setup.zip 文件魁兼。
3.解壓下載的 nvm-setup.zip 文件咏删,然后運行 nvm-setup.exe 安裝程序饱苟。
4.按照提示完成安裝瓦呼。
二 nvm常用命令
1.查看安裝路徑
$ command -v nvm
/c/Users/Administrator/AppData/Roaming/nvm/nvm
2.查看版本
$ nvm -v
1.1.12
3.安裝特定版本的 Node.js
nvm install 16.20.2
4.列出已安裝的 Node.js 版
$ nvm list
20.11.1
* 16.20.2 (Currently using 64-bit executable)
或
$ nvm ls
20.11.1
* 16.20.2 (Currently using 64-bit executable)
5.切換 Node.js 版本并驗證
$ nvm use 20.11.1
Now using node v20.11.1 (64-bit)
$ node -v
v20.11.1
6.卸載特定版本的 Node.js
nvm uninstall <version>
7.設(shè)置默認 Node.js 版本
nvm alias default <version>