|
瞎幾把前言:mac上可以用n來(lái)管理node版本,私以為n很好用。家里的win7臺(tái)式機(jī)一直沒(méi)有安裝過(guò)任何管理工具,今天來(lái)給家里電腦安裝一下nvw-windows,一個(gè)用于windows系統(tǒng)的node版本工具。
電腦系統(tǒng):系統(tǒng)win7 64位:
nvw-windows的官網(wǎng):https://github.com/coreybutler/nvm-windows/releases
一、安裝步驟:
(一)下載:
首先從官網(wǎng)下載安裝包 https://github.com/coreybutler/nvm-windows/releases,我下了一個(gè)setup版本的,下下來(lái)是個(gè)壓縮包,解壓后里面是一個(gè)exe,安裝方式就如同一個(gè)常見(jiàn)的exe安裝包,雙擊運(yùn)行即可:

(一)安裝:
1.雙擊exe開(kāi)始安裝:

2.下面這一步:配置nvm的安裝位置,任意一個(gè)你喜歡的位置都可以。

3.設(shè)置node的symlink文件夾位置。這個(gè)文件夾的名字一定不能含有中文或空格!

4.如果在安裝nvm之前,電腦上就已經(jīng)安裝有node的,會(huì)看到如下圖,詢(xún)問(wèn)你是否用nvm管理已經(jīng)存在的node版本。一定要選‘是’,這個(gè)彈窗可能會(huì)出現(xiàn)好幾次,都點(diǎn)是。

5.安裝完成??吹饺缦聢D:
(二)使用nvm:
1.檢查nvm是否安裝成功:
使用管理員權(quán)限打開(kāi)一個(gè)命令行。輸入nvm v,會(huì)顯示nvm的版本號(hào),有則表示安裝成功。
2. nvm各命令用法:(黏自官網(wǎng))
nvm arch [32|64]: Show if node is running in 32 or 64 bit mode. Specify 32 or 64 to override the default architecture.
nvm install <version> [arch]: The version can be a node.js version or "latest" for the latest stable version. Optionally specify whether to install the 32 or 64 bit version (defaults to system arch). Set [arch] to "all" to install 32 AND 64 bit versions.
nvm list [available]: List the node.js installations. Type available at the end to show a list of versions available for download.
nvm on: Enable node.js version management.
nvm off: Disable node.js version management (does not uninstall anything).
nvm proxy [url]: Set a proxy to use for downloads. Leave [url] blank to see the current proxy. Set [url] to "none" to remove the proxy.
nvm uninstall <version>: Uninstall a specific version.
nvm use <version> [arch]: Switch to use the specified version. Optionally specify 32/64bit architecture. nvm use <arch> will continue using the selected version, but switch to 32/64 bit mode based on the value supplied to <arch>. For information about using use in a specific directory (or using .nvmrc), please refer to issue #16.
nvm root <path>: Set the directory where nvm should store different versions of node.js. If <path> is not set, the current root will be displayed.
nvm version: Displays the current running version of NVM for Windows.
nvm node_mirror <node_mirror_url>: Set the node mirror.People in China can use https://npm./mirrors/node/
nvm npm_mirror <npm_mirror_url>: Set the npm mirror.People in China can use https://npm./mirrors/npm/
3. nvm常用命令(個(gè)人對(duì)上述命令中的常用命令的一個(gè)總結(jié)和翻譯):
- 安裝指定版本的node: nvm install 版本號(hào)
比如安裝8.9.3:
- 使用指定版本的node: nvm use 版本號(hào)
比如使用8.9.3:
- 使用淘寶node鏡像:nvm node_mirror
- 查看當(dāng)前電腦上已經(jīng)安裝的全部node版本,正在使用中的版本號(hào)前有個(gè)星號(hào):
二、NVM使用中常見(jiàn)錯(cuò)誤:
(一)、nvm use 出現(xiàn)exit status 1
|