npm 不支持 Node.js vX.X.X(当前)

npm does not support Node.js vX.X.X (current)

我正在安装与 npm 捆绑在一起的当前 Node.js(截至今天:13.12.0)。但是,最新的 npm 版本(截至今天:6.14.4)不支持当前的 Node.js 版本导致此错误:

npm WARN npm npm does not support Node.js v13.12.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12.
npm WARN npm You can find the latest version at https://nodejs.org/

我正在使用带有命令 choco install nodejs 的 Chocolatey 进行安装。通过 Node.js 安装程序安装时也会出现此错误。我该怎么做才能解决这个问题?

npm 总是落后于当前的 Node.js 版本。如果您的用例不是绝对需要最新的 Node.js 版本,我建议您安装 npm 始终支持的 LTS(长期支持)版本。

要做到这一点,请按照以下步骤操作:

  1. 通过您的 OS 卸载 Node.js 或者如果您使用的是 Chocolatey:choco uninstall nodejs.

  2. 如果您使用的是 Chocolatey,请使用 herechoco install nodejs-lts 找到的安装程序安装 LTS 版本。最新的 npm 将与这两种方式一起安装。

  3. 重启机器。