前言

由于高版本的node.js导致gulp执行build命令失败,我需要在Windows下卸载掉已有的node.js并安装一个多版本管理工具nvm-windows,方便切换不同版本的node.js。

nvm是Linux下常用的一个node.js多版本管理工具,但是nvm不能在Windows下使用,在GitHub上有个项目叫nvm-windows,可以让我们在Windows下对node.js进行多版本管理。

nvm-windows的下载地址:https://github.com/coreybutler/nvm-windows/releases

根据官方说明:

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-windows前,如果以前安装过node,需要先卸载,并且要把目录清理干净。

在Windows下完全卸载已安装的node.js

  1. 从卸载程序卸载程序和功能,也可以直接右键node.js的安装包并选择卸载。
  2. 重新启动(或者重新启动任务管理器杀死所有与节点相关的进程)。
  3. 从下列的目录中找到相关的内容并删除掉:
    1. C:\Program Files (x86)\nodejs
    2. C:\Program Files\nodejs
    3. C:\Users\{User}\AppData\Roaming\npm(或%appdata%\npm
    4. C:\Users\{User}\AppData\Roaming\npm-cache(或%appdata%\npm-cache
  4. 检查%PATH%环境变量以确保没有引用Nodejs或npm存在。
  5. 重新启动电脑。

安装nvm-windows并使用

到GitHub的项目下载地址,选择下载nvm-setup.zip,解压后双击使用安装程序即可。

查看已安装的nodejs版本

nvm list

如果是第一次安装,使用该命令结果如下:

C:\Users\Lewis>nvm list

No installations recognized.

查看可安装的nodejs版本

nvm list available

输入该命令结果如下:

C:\Users\Lewis>nvm list available

|   CURRENT    |     LTS      |  OLD STABLE  | OLD UNSTABLE |
|--------------|--------------|--------------|--------------|
| 11.10.0 | 10.15.1 | 0.12.18 | 0.11.16 |
| 11.9.0 | 10.15.0 | 0.12.17 | 0.11.15 |
| 11.8.0 | 10.14.2 | 0.12.16 | 0.11.14 |
| 11.7.0 | 10.14.1 | 0.12.15 | 0.11.13 |
| 11.6.0 | 10.14.0 | 0.12.14 | 0.11.12 |
| 11.5.0 | 10.13.0 | 0.12.13 | 0.11.11 |
| 11.4.0 | 8.15.0 | 0.12.12 | 0.11.10 |
| 11.3.0 | 8.14.1 | 0.12.11 | 0.11.9 |
| 11.2.0 | 8.14.0 | 0.12.10 | 0.11.8 |
| 11.1.0 | 8.13.0 | 0.12.9 | 0.11.7 |
| 11.0.0 | 8.12.0 | 0.12.8 | 0.11.6 |
| 10.12.0 | 8.11.4 | 0.12.7 | 0.11.5 |
| 10.11.0 | 8.11.3 | 0.12.6 | 0.11.4 |
| 10.10.0 | 8.11.2 | 0.12.5 | 0.11.3 |
| 10.9.0 | 8.11.1 | 0.12.4 | 0.11.2 |
| 10.8.0 | 8.11.0 | 0.12.3 | 0.11.1 |
| 10.7.0 | 8.10.0 | 0.12.2 | 0.11.0 |
| 10.6.0 | 8.9.4 | 0.12.1 | 0.9.12 |
| 10.5.0 | 8.9.3 | 0.12.0 | 0.9.11 |
| 10.4.1 | 8.9.2 | 0.10.48 | 0.9.10 | This is a partial list. For a complete list, visit https://nodejs.org/download/release

安装指定版本的nodejs

nvm install 8.11.2 64-bit

安装成功后可以查询看看已安装的nodejs版本:

C:\Users\Lewis>nvm list

    8.11.2

有需要的话,可以继续安装其他版本的nodejs。

使用指定版本的nodejs

nvm use 8.11.2

安装成功后可以验证下版本:

C:\Users\Lewis>nvm list

  * 8.11.2 (Currently using 64-bit executable)

C:\Users\Lewis>node -v
v8.11.2

删除指定版本的nodejs

nvm uninstall 8.11.2

参考链接

Windows下完全卸载node.js并安装node.js的多版本管理工具nvm-windows的更多相关文章

  1. Node版本管理工具-NVM的安装与使用(windows系统)

    友情提示:为避免踩坑,建议浏览全文后动手操作!!! 一.nvm是什么 看到这篇文章的猿/媛们肯定不会问这个问题了,但是我还是要说,哈哈哈! 无论工作还是干嘛,就不会一直做项目,所以肯定也不会一直用一个 ...

  2. Android ROM开发(一)——Windows下Cygwin和Android_Kitchen厨房的安装

    Android ROM开发(一)--Windows下Cygwin和Android_Kitchen厨房的安装 很久没有碰到ROM开发了,在很久很久以前也是从ROM起步的,无奈还是一脚踏上了Android ...

  3. 全网最全的Windows下Anaconda2 / Anaconda3里正确下载安装爬虫框架Scrapy(离线方式和在线方式)(图文详解)

    不多说,直接上干货! 参考博客 全网最全的Windows下Anaconda2 / Anaconda3里正确下载安装OpenCV(离线方式和在线方式)(图文详解) 第一步:首先,提示升级下pip 第二步 ...

  4. 全网最全的Windows下Python2 / Python3里正确下载安装用来向微信好友发送消息的itchat库(图文详解)

    不多说,直接上干货! 建议,你用Anaconda2或Anaconda3. 见 全网最全的Windows下Anaconda2 / Anaconda3里正确下载安装用来向微信好友发送消息的itchat库( ...

  5. Windows下IIS+PHP 5.2的安装与配置

    Windows下IIS+PHP 5.2的安装与配置   Windows下PHP的安装虽然简单,但如果不注意方法,仍然会让你头疼.此外,PHP 5.2版本与之前4.x版本也有一些不同,所以有必要记录一下 ...

  6. windows下的Nodejs及npm的安装、常用命令,Nodejs开发环境配置

    http://www.cnblogs.com/webstorm/p/5744942.html ***************************************** 第一步:下载Nodej ...

  7. windows下Gulp入门详细教程 &&gulp安装失败的原因(红色)

    以下教程亲自实践可行: 另外添加一个Gulp自动编译.压缩.更新.测试的教程链接:https://markpop.github.io/2014/09/17/Gulp%E5%85%A5%E9%97%A8 ...

  8. windows下Go升级及GoLand的安装激活

    之前在qor/China上问golang项目包有没有一键安装,有位朋友给出了回复: 于是,尝试了下升级Go,目前版本是1.10.1,现升级为为1.12.2.步骤如下: 一.下载安装包 下载地址:htt ...

  9. 全网最全的Windows下Anaconda2 / Anaconda3里正确下载安装OpenCV(离线方式和在线方式)(图文详解)

    不多说,直接上干货! 说明: Anaconda2-5.0.0-Windows-x86_64.exe安装下来,默认的Python2.7 Anaconda3-4.2.0-Windows-x86_64.ex ...

随机推荐

  1. jquery带按钮的图片切换效果

    <!doctype html> <html> <head> <meta charset="gb2312"> <title> ...

  2. SpringMVC+Spring+MyBatis配置

    今天配置项目时遇到一个问题,tomcat启动没有报错,但是访问页面的时总是报404,后台打印的日志是: 8080-exec-1] WARN springframework.web.servlet.Pa ...

  3. CodeForces - 385E Bear in the Field —— 矩阵快速幂

    题目链接:https://vjudge.net/problem/CodeForces-385E E. Bear in the Field time limit per test 1 second me ...

  4. html5--3.19 新增的progress/meter元素

    html5--3.19 新增的progress/meter元素 学习要点 了解progress/meter元素的用法 progress元素 是HTML5中新增的元素,用来建立一个进度条 通常与Java ...

  5. APTM敏捷性能测试模型

    随着应用系统的日趋复杂,仅在系统测试和验收测试阶段执行性能测试已经不能满足迟早发现和解决系统性能瓶颈的要求,Connie Smith博士和Lloyd Winlliams博士在他们提出 的软件性能工程( ...

  6. 在Eclipse配置自动提示

    1.我们打开eclipse,选择菜单栏的window选项 2.点击Windows,选择下拉菜单里面的preferences选项,之后在打开的对话框的左侧找到Java选项 3.之后点击Java选项,选择 ...

  7. 如何配置xmanager

      步骤1:编辑/etc/X11/xdm/Xaccess,将下面的行:  #* # any host can get a login window 改为: * # any host can get a ...

  8. [YNOI 2016] 掉进兔子洞

    [题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=4939 [算法] 不难发现 , ansi = (r1 - l1 + 1) + (r2 ...

  9. Persistent connections CONN_MAX_AGE django

    Persistent connections¶ Persistent connections avoid the overhead of re-establishing a connection to ...

  10. C++模板之函数模板实例化和具体化

    模板声明 template<typename/class T>,  typename比class最近后添加到C++标准. 常规模板,具体化模板,非模板函数的优先调用顺序. 非模板函数(普通 ...