我会定期遇到问题,不得不使用已弃用的 Angular 依赖项启动旧的 Angular 项目。
因为我不正常地运行最新的 Node.js 版本(至少是最新的 LTS 版本),所以我经常遇到问题,即我无法让旧项目运行。我通过使用节点版本管理器解决了这个问题,但我仍然经常遇到问题,我不确定用于 Angular 版本 X 的最佳 Node.js 版本是什么。
遗憾的是,official release notes 处理这个话题的方式很糟糕,并不是真正的帮助,尤其是如果您想知道哪个 Angular 版本您不能再使用特定的 Node.js 版本...
是否有完整的兼容性列表来检查哪个 Angular 版本与哪个 Node.js 版本兼容?
|Angular CLI| Angular | NodeJS |TypeScript | RxJS Version |
|-----------|--------------------|------------------------------ |-----------|-----------------------------------------|
|- |2.x |6.0.x or later minor |2.0.x |5.0.x/5.1.x/5.2.x/5.3.x/5.4.x/5.5.x |
|1.0.6 |4.x |6.9.x or later minor |2.2.x |5.0.x/5.1.x/5.2.x/5.3.x/5.4.x/5.5.x |
|1.1.3 |4.x |6.9.x or later minor |2.3.x |5.0.x/5.1.x/5.2.x/5.3.x/5.4.x/5.5.x |
|1.2.7 |4.x |6.9.x or later minor |2.3.x |5.0.x/5.1.x/5.2.x/5.3.x/5.4.x/5.5.x |
|1.3.2 |4.2.x or later minor|6.9.x or later minor |2.4.x |5.0.x/5.1.x/5.2.x/5.3.x/5.4.x/5.5.x |
|1.4.10 |4.2.x or later minor|6.9.x/8.9.x or later minor |2.4.x |5.0.x/5.1.x/5.2.x/5.3.x/5.4.x/5.5.x |
|(1.5.6) |5.0.x |6.9.x/8.9.x or later minor |2.4.x |5.5.x |
|1.5.6 |5.1.x |6.9.x/8.9.x or later minor |2.5.x |5.5.x |
|1.6.7 |5.2.x or later minor|6.9.x/8.9.x or later minor |2.5.x |5.5.x |
|1.7.4 |5.2.x or later minor|6.9.x/8.9.x or later minor |2.5.x |5.5.x |
|6.0.8 |6.0.x |8.9.x or later minor |2.7.x |6.0.x/6.1.x/6.2.x/6.3.x/6.4.x/6.5.x/6.6.x|
|6.1.5 |6.1.x |8.9.x or later minor |2.7.x |6.2.x/6.3.x/6.4.x/6.5.x/6.6.x |
|6.2.9 |6.1.x |8.9.x or later minor |2.9.x |6.2.x/6.3.x/6.4.x/6.5.x/6.6.x |
|7.0.7 |7.0.x |8.9.x/10.9.x or later minor |3.1.x |6.3.x/6.4.x/6.5.x/6.6.x |
|7.1.4 |7.1.x |8.9.x/10.9.x or later minor |3.1.x |6.3.x/6.4.x/6.5.x/6.6.x |
|7.2.4 |7.2.x |8.9.x/10.9.x or later minor |3.2.x |6.3.x/6.4.x/6.5.x/6.6.x |
|7.3.9 |7.2.x |8.9.x/10.9.x or later minor |3.2.x |6.3.x/6.4.x/6.5.x/6.6.x |
|8.0.6 |8.0.x |10.9.x or later minor |3.4.x |6.4.x/6.5.x/6.6.x |
|8.1.3 |8.1.x |10.9.x or later minor |3.4.x |6.4.x/6.5.x/6.6.x |
|8.2.2 |8.2.x |10.9.x or later minor |3.4.x |6.4.x/6.5.x/6.6.x |
|8.3.25 |8.2.x |10.9.x or later minor |3.5.x |6.4.x/6.5.x/6.6.x |
|9.0.7 |9.0.7 |10.13.x/12.11.x or later minor |3.6.x/3.7.x|6.5.x/6.6.x |
|9.x |9.x |10.13.x/12.11.x or later minor |3.6.x-3.8.x|6.5.x/6.6.x |
|10.x |10.x |10.13.x/12.11.x or later minor |3.9.x |6.5.x/6.6.x |
|10.1.x |10.1.x |10.13.x/12.11.x or later minor |3.9.x/4.0.x|6.6.x |
|10.2.x |10.2.x |10.13.x/12.11.x or later minor |3.9.x/4.0.x|6.6.x |
|11.0.7 |11.0.x |10.13.x/12.11.x or later minor |4.0.x |6.6.x |
|11.1.x |11.1.x |10.13.x/12.11.x or later minor |4.0.x/4.1.x|6.6.x |
|11.2.x |11.2.x |10.13.x/12.11.x or later minor |4.0.x/4.1.x|6.6.x |
|12.0.x |12.0.x |12.14.x/14.15.x or later minor |4.2.x |6.6.x |
|12.1.x |12.1.x |12.14.x/14.15.x or later minor |4.2.x/4.3.x|6.6.x |
|12.2.x |12.2.x |12.14.x/14.15.x or later minor |4.2.x/4.3.x|6.6.x/7.0.x or later minor version |
|13.0.x |13.0.x |12.20.x/14.15.x/16.10.x or later minor version|4.4.x |6.6.x/7.4.x or later minor version |
|13.1.x |13.1.x |12.20.x/14.15.x/16.10.x or later minor version|4.4.x/4.5.x|6.6.x/7.4.x or later minor version |
|13.2.x |13.2.x |12.20.x/14.15.x/16.10.x or later minor version|4.4.x/4.5.x|6.6.x/7.4.x or later minor version |
|13.3.x |13.3.x |12.20.x/14.15.x/16.10.x or later minor version|4.4.x/4.7.x|6.6.x/7.4.x or later minor version |
|14.0.x |14.0.x |14.15.x/^16.10.x or later minor version |4.6.x/4.8.x|6.6.x/7.4.x or later minor version |
|-----------|--------------------|----------------------------------------------|-----------|-----------------------------------------|
参考:https://gist.github.com/LayZeeDK/c822cc812f75bb07b7c55d07ba2719b3
我承认这实际上并不能回答您的问题。但它确实为当前版本提供了一些相关信息(这就是把我带到这里的原因)。
以下是 Angular 对当前版本的官方说法:
https://angular.io/guide/setup-local
“Angular 需要 Node.js 的当前、活动 LTS 或维护 LTS 版本。”
在注释中,您将看到一个指向包含“引擎”部分的 package.json 文件的链接。对于 Angular 11,它说:
"engines": {
"node": ">= 10.13.0",
"npm": ">= 6.11.0",
"yarn": ">= 1.13.0"
},
是否可以在 GitHub 中查看 package.json 的发布版本并确定engines.node 设置?
engines
有 647 次点击。但是,我想我们正在这里寻找 CLI 的 NodeJS 兼容性,即 "node": "^12.20.0 || ^14.15.0 || >=16.10.0"
不定期副业成功案例分享
You can no longer use Angular with Node.js version 10 or older
。与非官方文档有关的评论多么无用。我已经尝试过 Node v16,但它在使用 Angular 12 时完全失败了。如果我从商店购买软件,我需要知道它是否在 Windows 上运行。盒子告诉我。那么为什么谷歌不能告诉我们这个简单的信息呢?