前言
今天要编译一个其他nodejs版本的程序,然后就去github找找看看是不是有相应的nodejs版本管理工具,然后就找到了!
nvm-windows
: https://github.com/coreybutler/nvm-windows
步骤
主要分为安装和使用两个步骤~
安装
下载
下载地址
: https://github.com/coreybutler/nvm-windows/releases/
本次安装的为1.17版本
安装
- 解压双击nvm-setup.exe并同意协议
- 选择nvm安装路径
安装路径不可带空格
- 选择nodejs路径
- 确认安装即可
- 安装完确认
- 验证
nvm version
使用
命令列表
$ nvm --help Running version 1.1.7. Usage: nvm arch : Show if node is running in 32 or 64 bit mode. nvm install <version> [arch] : The version can be a node.js version or "latest" for the latest stable versio n. Optionally specify whether to install the 32 or 64 bit version (defaults to s ystem arch). Set [arch] to "all" to install 32 AND 64 bit versions. Add --insecure to the end of this command to bypass SSL validation of the rem ote download server. nvm list [available] : List the node.js installations. Type "available" at the end to see what can b e installed. Aliased as ls. nvm on : Enable node.js version management. nvm off : Disable node.js version management. 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 node_mirror [url] : Set the node mirror. Defaults to https://nodejs.org/dist/. Leave [url] blank to use default url. nvm npm_mirror [url] : Set the npm mirror. Defaults to https://github.com/npm/cli/archive/. Leave [u rl] blank to default url. nvm uninstall <version> : The version must be 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. 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. Aliased as v.
修改镜像源
##nodejs nvm node_mirror https://npm.taobao.org/mirrors/node/ ##npm nvm npm_mirror https://npm.taobao.org/mirrors/npm/
查看node可安装版本
nvm ls available
nvm ls 是nvm list的简写
安装nodejs
## 安装最新版本 nvm install latest ## 安装指定版本 nvm install 14.15.0
切换版本
nvm use 15.8.0
卸载nodejs
nvm uninstall 15.8.0
报错
切换版本报错
C:\Users\WangYang>nvm use 14.15.0 exit status 1: 'D:\Program' �����ڲ����ⲿ���Ҳ���ǿ����еij��� ���������ļ���
因为目录路径包含空格,仓库中回复是在1.1.8版本会解决,我这里是直接卸载重新安装了。
学无止境,谦卑而行.