nodejs 009: (工具相关)使用nvm进行node版本管理(包括Could not retrieve的手动处理办法)

nvm

  • 有些问题类似:“v8::Object::Set": No overloaded function accepts 2 Arguments”可能需要通过更换nodejs的版本来解决(如下图所示,需要看当时的项目的时间,查找当时的流行nodejs版本)。
  • 这时可以使用nvm进行安装和切换不同版本的nodejs的工具。

在这里插入图片描述

下载安装

添加镜像

在这里插入图片描述
在这里插入图片描述

nvm中安装node

nvm install 11.5.0

安装node的报错及处理方式

C:\Users\kingchuxing>nvm install 11

Could not retrieve https://nodejs.org/dist/latest-v11.x/SHASUMS256.txt.

Get "https://nodejs.org/dist/latest-v11.x/SHASUMS256.txt": dial tcp 104.20.22.46:443: i/o timeout
  • 手动安装:去node官网下载安装包,解压放到nvm路径后重命名为版本开头的文件夹,并点击instll_tool.bat进行安装

在这里插入图片描述

在这里插入图片描述

nvm的使用

#查看nodejs版本
node -v

#查看已安装所有版本
nvm list 

#切换版本
nvm use 11.5.0

#查看nodejs版本
nvm -v

# 其他命令
Usage:
 
  nvm arch                     : Show if node is running in 32 or 64 bit mode.
  nvm current                  : Display active version.
  nvm debug                    : Check the NVM4W process for known problems (troubleshooter).
  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.
  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 use "latest", "lts", or "newest".
                                 "newest" is the latest installed 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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值