我正在使用 nodejs v8.8.1 和 angular-cli v6.0.8,但我收到了这个错误:
You are running version v8.8.1 of Node.js, which is not supported by Angular CLI v6. The official Node.js version that is supported is 8.9 and greater.
如果我要安装不同版本的 angular-cli,我如何检查 nodejs v8.8.1 支持哪个版本? 我不能反过来做,因为我必须使用 nodejs v8.8.1。
最佳答案
TL;DR:如果您不能使用任何其他版本的 Node ,看起来您应该使用 v5
。
我所做的是克隆 angular-cli
repo 然后运行:
git log --oneline -p -L 48,48:package.json --diff-filter=m
--oneline
仅显示提交的简短日志-p
生成补丁列表-L 48,48:package.json
这是 Node 版本在提交7924e0a
时在package.json
中设置的当前行--diff-filter=m
仅显示文件修改(尽管这在这里可能无关紧要)
产生了下面的日志列表。这显示每次显式 node
版本要求在 package.json
engine
属性中发生变化。
如您所见,它已更改 3 次:
-
c38b5c09
它被显式设置为node >= 4.1.0
-
08af5d54
它没有改变,但是设置了一个明确的npm
版本 (npm >=3.0.0
) -
0a1f19ff
它被设置为node >= 6.9.0
-
29338bca
它被设置为node >= 8.9.0
因此,据此,您可以假设您可以使用该提交应该工作之前的任何 Angular 版本。该特定提交适用于 v6.0.0-beta3
。所以我会说主要版本 v5
。
git log
输出
29338bca refactor: set minimum node version to 8.9
diff --git a/package.json b/package.json
--- a/package.json
+++ b/package.json
@@ -34,2 +34,1 @@
- "node": ">= 6.9.0",
- "npm": ">= 3.0.0"
+ "node": ">= 8.9.0",
0a1f19ff build: specify package node v6 engine dependency
diff --git a/package.json b/package.json
--- a/package.json
+++ b/package.json
@@ -32,2 +32,2 @@
- "node": ">= 4.1.0",
+ "node": ">= 6.9.0",
"npm": ">= 3.0.0"
08af5d54 chore: add engine entries to package.json
diff --git a/package.json b/package.json
--- a/package.json
+++ b/package.json
@@ -33,1 +33,2 @@
- "node": ">= 4.1.0"
+ "node": ">= 4.1.0",
+ "npm": ">= 3.0.0"
c38b5c09 chore(deps): make node 4.1.0 requirement explicit
diff --git a/package.json b/package.json
--- a/package.json
+++ b/package.json
@@ -18,0 +19,1 @@
+ "node": ">= 4.1.0"
关于node.js - 我如何找出nodejs支持哪个版本的angular-cli?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50764162/