瞎幾把前言:mac上可以用n來管理node版本,私以為n很好用。家里的win7台式機一直沒有安裝過任何管理工具,今天來給家里電腦安裝一下nvw-windows,一個用於windows系統的node版本工具。
電腦系統:系統win7 64位:
nvw-windows的官網:https://github.com/coreybutler/nvm-windows/releases
一、安裝步驟:
(一)下載:
首先從官網下載安裝包 https://github.com/coreybutler/nvm-windows/releases,我下了一個setup版本的,下下來是個壓縮包,解壓后里面是一個exe,安裝方式就如同一個常見的exe安裝包,雙擊運行即可:
(一)安裝:
1.雙擊exe開始安裝:
2.下面這一步:配置nvm的安裝位置,任意一個你喜歡的位置都可以。
3.設置node的symlink文件夾位置。這個文件夾的名字一定不能含有中文或空格!
4.如果在安裝nvm之前,電腦上就已經安裝有node的,會看到如下圖,詢問你是否用nvm管理已經存在的node版本。一定要選‘是’,這個彈窗可能會出現好幾次,都點是。
5.安裝完成。看到如下圖:
(二)使用nvm:
1.檢查nvm是否安裝成功:
使用管理員權限打開一個命令行。輸入nvm v,會顯示nvm的版本號,有則表示安裝成功。
2. nvm各命令用法:(黏自官網)
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. Typeavailable
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 usinguse
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.taobao.org/mirrors/node/nvm npm_mirror <npm_mirror_url>
: Set the npm mirror.People in China can use https://npm.taobao.org/mirrors/npm/
3. nvm常用命令(個人對上述命令中的常用命令的一個總結和翻譯):
- 安裝指定版本的node: nvm install 版本號
比如安裝8.9.3:
nvm install 8.9.3
- 使用指定版本的node: nvm use 版本號
比如使用8.9.3:
nvm use 8.9.3
- 使用淘寶node鏡像:nvm node_mirror
nvm node_mirror https://npm.taobao.org/mirrors/node/
- 使用淘寶npm鏡像:nvm npm_mirror
nvm npm_mirror https://npm.taobao.org/mirrors/npm/
- 查看當前電腦上已經安裝的全部node版本,正在使用中的版本號前有個星號:
nvm ls
- 查看可用的(可下載的)全部node版本:
nvm ls available
二、NVM使用中常見錯誤:
(一)、nvm use 出現exit status 1