如何解决奇数编号的 Node.js 版本不会进入 LTS 状态且不应用于生产节点:16120 UnhandledPromiseRejectionWarning

问题描述 投票:0回答:3

我尝试创建一个新的角度应用程序ng新应用程序,但我收到了这个错误

Node.js version v11.0.0 detected.
Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/releases/.
(node:16120) UnhandledPromiseRejectionWarning: Error: Not supported
    at Object.<anonymous> (/home/user/.nvm/versions/node/v11.0.0/lib/node_modules/@angular/cli/bin/bootstrap.js:21:1)
    at Module._compile (internal/modules/cjs/loader.js:707:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)
    at Module.load (internal/modules/cjs/loader.js:605:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:544:12)
    at Function.Module._load (internal/modules/cjs/loader.js:536:3)
    at Module.require (internal/modules/cjs/loader.js:643:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/home/user/.nvm/versions/node/v11.0.0/lib/node_modules/@angular/cli/bin/ng.js:47:3)
    at Module._compile (internal/modules/cjs/loader.js:707:30)
(node:16120) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:16120) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

我尝试卸载 Node、npm 和 Angular,然后再次安装它们,但遇到了同样的错误

node.js angularjs npm
3个回答
1
投票

将节点版本更新到 19.x 后,我也遇到了这个问题。但后来我将节点版本更新到最新的稳定版本,这个问题就解决了。 尝试使用此链接上的以下步骤更新您的节点:

https://codeforgeek.com/update-node-using-npm/


1
投票

当我将最新版本的 Angular 15 与现有节点版本 17.9.0 一起使用时,我也面临这个问题(即从最新版本降级 2 步,无 LTS)。

Angular 的版本应该兼容某些 Node 版本。大多数LTS节点版本都有一定程度的支持。目前对我来说,最新的 Angular 版本 15node 版本 ^14.20.0 || 兼容^16.13.0 || ^18.10.0(全部带有 LTS)或最新版本。

有关参考,请查看有关角度和节点版本兼容性的问题

来源:在 GitHub Gist

上查看各种版本的 Angular、Node、TypeScript 和 RxJS 之间的兼容性的完整列表

0
投票
<p>hello dwygbyucicrguiixnuiwehui</p>
© www.soinside.com 2019 - 2024. All rights reserved.