0%

Windows下安装nvm管理nodejs版本

前言

nvm全名node.js version management,顾名思义是一个nodejs的版本管理工具。通过它可以安装和切换不同版本的nodejs。下面列出下载、安装及使用方法。

下载

可在github上下载最新版本,本次下载安装的是windows版本。打开网址我们可以看到有两个版本:

  • nvm-noinstall.zip:绿色免安装版,但使用时需进行配置。
  • nvm-setup.zip:安装版,推荐使用

    安装

    双击安装文件 nvm-setup.exe

    安装文件

    选择nvm安装路径

    选择nvm安装路径

    选择nodejs路径

    选择nodejs路径

    确认安装即可

    确认安装

    安装完确认

    安装成功则如下显示。可以看到里面列出了各种命令
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
      $ nvm

    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 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.
    nvm npm_mirror [url] : Set the npm mirror. Defaults to https://github.com/npm/cli/archive/. Leave [url] 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 list 后显示的 * 表示的是当前正在使用的版本
    1
    2
    3
    4
    5
    $ nvm list

    * 15.3.0 (Currently using 64-bit executable)
    10.4.0

    安装,版本号可自定义

    1
    nvm install 10.4.0

    使用特定版本

    1
    nvm use 10.4.0

    卸载

    1
    nvm uninstall 11.13.0
--------- 本文结束感谢您的阅读 ---------
分享