Windows上node.js的多版本管理工具用法實例分析
本文實例講述了Windows上node.js的多版本管理工具用法。分享給大家供大家參考,具體如下:
在Linux上我一直使用nvm來管理nodejs的不同版本,但是nvm沒有windows版本,今天發(fā)現(xiàn)在windows上可以使用另外一個版本管理工具nvm-windows來管理。
下載與安裝
下載地址:https://github.com/coreybutler/nvm-windows/releases
安裝前,這里有一點需要注意,如果以前安裝過node,需要先卸載,并且要把目錄清理干凈。下面是官方給的說明:
It comes with an installer (and uninstaller), because getting it should be easy. Please note, you need to uninstall any existing versions of node.js before installing NVM for Windows. Also delete any existing nodejs installation directories (e.g., "C:\Program Files\nodejs") that might remain. NVM's generated symlink will not overwrite an existing (even empty) installation directory.
You should also delete the existing npm install location (e.g. "C:\Users<user>\AppData\Roaming\npm") so that the nvm install location will be correctly used instead. After install, reinstalling global utilities (e.g. gulp) will have to be done for each installed version of node:
安裝的時候需要制定兩個目錄,一個是nvm的安裝目錄,一個是建立node軟連接的目錄。
nvm的安裝目錄(絕對路徑所有層級)中最好不要存在中文或者兩個單詞以上的路徑,如Progrom Files等,否則可能導致命令運行出錯。
所有下載的node包在nvm安裝目錄下,只是在更改了node軟連接的目錄,并將node軟連接目錄增加到了環(huán)境變量中。原理還是很簡單的。
使用
查看當前已經(jīng)安裝的nodejs版本
C:\Users\kongxx> nvm list No installations recognized.
因為是新安裝,所以提示系統(tǒng)沒有安裝任何版本。
查看可以安裝的nodejs版本
C:\Users\kongxx> nvm list available | CURRENT | LTS | OLD STABLE | OLD UNSTABLE | |--------------|--------------|--------------|--------------| | 8.8.1 | 6.11.5 | 0.12.18 | 0.11.16 | | 8.8.0 | 6.11.4 | 0.12.17 | 0.11.15 | | 8.7.0 | 6.11.3 | 0.12.16 | 0.11.14 | | 8.6.0 | 6.11.2 | 0.12.15 | 0.11.13 | | 8.5.0 | 6.11.1 | 0.12.14 | 0.11.12 | | 8.4.0 | 6.11.0 | 0.12.13 | 0.11.11 | | 8.3.0 | 6.10.3 | 0.12.12 | 0.11.10 | | 8.2.1 | 6.10.2 | 0.12.11 | 0.11.9 | | 8.2.0 | 6.10.1 | 0.12.10 | 0.11.8 | | 8.1.4 | 6.10.0 | 0.12.9 | 0.11.7 | | 8.1.3 | 6.9.5 | 0.12.8 | 0.11.6 | | 8.1.2 | 6.9.4 | 0.12.7 | 0.11.5 | | 8.1.1 | 6.9.3 | 0.12.6 | 0.11.4 | | 8.1.0 | 6.9.2 | 0.12.5 | 0.11.3 | | 8.0.0 | 6.9.1 | 0.12.4 | 0.11.2 | | 7.10.1 | 6.9.0 | 0.12.3 | 0.11.1 | | 7.10.0 | 4.8.5 | 0.12.2 | 0.11.0 | | 7.9.0 | 4.8.4 | 0.12.1 | 0.9.12 | | 7.8.0 | 4.8.3 | 0.12.0 | 0.9.11 | | 7.7.4 | 4.8.2 | 0.10.48 | 0.9.10 |
安裝指定版本的node
這里安裝了 6.10.0 和 7.10.0 兩個版本
C:\Users\kongxx> nvm install 6.10.0 64-bit ... C:\Users\kongxx> nvm install 7.10.0 64-bit
再次查看已安裝的版本
C:\Users\kongxx> nvm list 7.10.0 6.10.0
使用指定版本的node
C:\Users\kongxx> nvm use 6.10.0 Now using node v6.10.0 (64-bit) C:\Users\kongxx> nvm list 7.10.0 * 6.10.1 (Currently using 64-bit executable) C:\Users\kongxx> node -v v6.10.0
刪除指定版本的node
C:\Users\kongxx> nvm uninstall 7.10.0
希望本文所述對大家node.js程序設計有所幫助。
相關(guān)文章
Node.js數(shù)據(jù)庫操作之查詢MySQL數(shù)據(jù)庫(二)
這篇文章主要介紹了Node.js數(shù)據(jù)庫操作之查詢MySQL數(shù)據(jù)庫的相關(guān)資料,文中介紹的非常詳細,對大家學習或者使用mysql能帶來一定的幫助,需要的朋友可以參考借鑒,下面來一起看看吧。2017-03-03Node.js connect ECONNREFUSED錯誤解決辦法
這篇文章主要介紹了Node.js connect ECONNREFUSED錯誤解決辦法的相關(guān)資料,需要的朋友可以參考下2016-09-09nodejs版本過高導致vue2版本的項目無法正常啟動的解決方案
這篇文章主要給大家介紹了關(guān)于nodejs版本過高導致vue2版本的項目無法正常啟動的解決方案,本文小編給大家詳細介紹了如何解決這個問題,如有遇到同樣問題的朋友可以參考下2023-11-11使用nodejs中httpProxy代理時候出現(xiàn)404異常的解決方法
下面小編就為大家?guī)硪黄褂胣odejs中httpProxy代理時候出現(xiàn)404異常的解決方法。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-08-08nodejs使用PassThrough流進行數(shù)據(jù)傳遞合并示例詳解
這篇文章主要為大家介紹了nodejs使用PassThrough流進行數(shù)據(jù)傳遞合并示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-09-09