nvm 1.2.2 切换低版本node问题

1 阅读1分钟
  1. nvm 版本:1.2.2

  2. 问题:nvm下载14及以下版本发生错误

    如:

    
    PS C:\Users\xxx\xxx> nvm install 14.17.0
    Downloading node.js version 14.17.0 (64-bit)...
    Complete
    Downloading npm...
    Creating C:\xxx\xxx\xxx\xxx\Temp
    
    Downloading npm version 6.14.13... Complete
    Installing npm v6.14.13...
        error installing 14.17.0: open C:\xxx\xxx\xxx\xxx\Temp\npm-v6.14.13.zip: The system cannot find the file specified.
        ```
    
  3. 错误原因: nvm 会在临时目录里查找文件,但未找到文件,从而发生错误。 这是 nvm-windows 1.2.0 之后重构时引入的 bug,在 GitHub Issue #1229 中有记录。

  4. 解决办法:降低nvm版本至1.1.12

    (1) 卸载当前版本的 nvm

    • 打开 控制面板程序和功能,找到并卸载 nvm

    (2)安装1.1.12版本nvm,下载地址。 找到1.1.12版本,

image.png

image.png

下载下来,点击安装就ok了,安装成功之后,nvm version查看版本.

  1. 安装nvm 14版本(建议使用淘宝镜像)

    淘宝镜像: node镜像:nvm node_mirror npmmirror.com/mirrors/nod…

    npm镜像:nvm npm_mirror mirrors.cloud.tencent.com/npm/

    安装:nvm install 14

    使用:nvm use 14

    查看nvm已有node版本:nvm ls