node系列-使用nvm-windows管理nodejs版本

本文详细指导如何在Windows系统中正确卸载、重置和安装nvm-windows,包括清理环境变量、更换下载源,以及常见错误解决方案。通过nvm管理不同Node.js版本,如查看、安装、切换和卸载,确保高效且无误的开发环境。

在window上管理nodejs版本,安装nvm-windows

第一次安装使用nvm-windows,会遇到好多坑,请仔细按一下步骤安装:

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

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

地址:https://github.com/coreybutler/nvm-windows/releases
下载最新版本安装包即可:
在这里插入图片描述
解压后里面是nvm-setup.exe安装文件,默认安装即可,记住默认安装哦,不然安装node时有可能没有权限而无法创建node快捷方式。

  • 测试是否安装成功(有坑)

打开CMD窗口,直行nvm,如果显示版本等信息,则说明安装成功。

C:\Users\Administrator>nvm

Running version 1.1.8.

Usage:

  nvm arch                     : Show if node is running in 32 or 64 bit mode.
  nvm current                  : Display active version.
  nvm install <version> [arch] : The version can be a specific version, "latest" for the latest current version, or "lts" for the
                                 most recent LTS 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.
                                 Add --insecure to the end of this command to bypass SSL validation of the remote download server.
  nvm list [available]         : List the node.js installations. Type "available" at the end to see what can be 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.
  n
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值