Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0883248

Browse filesBrowse files
committed
fix(@angular/cli): improve Node.js version check and error messages
Enhances the Node.js version validation to include Node.js 22.12 (cherry picked from commit abe69dd)
1 parent 87266b3 commit 0883248
Copy full SHA for 0883248

File tree

Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed
Filter options
  • packages/angular/cli/bin
Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed

‎packages/angular/cli/bin/ng.js

Copy file name to clipboardExpand all lines: packages/angular/cli/bin/ng.js
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ try {
3131
}
3232

3333
const rawCommandName = process.argv[2];
34-
3534
if (rawCommandName === '--get-yargs-completions' || rawCommandName === 'completion') {
3635
// Skip Node.js supported checks when running ng completion.
3736
// A warning at this stage could cause a broken source action (`source <(ng completion script)`) when in the shell init script.
@@ -43,8 +42,9 @@ if (rawCommandName === '--get-yargs-completions' || rawCommandName === 'completi
4342
// This node version check ensures that extremely old versions of node are not used.
4443
// These may not support ES2015 features such as const/let/async/await/etc.
4544
// These would then crash with a hard to diagnose error message.
46-
var version = process.versions.node.split('.').map((part) => Number(part));
47-
if (version[0] % 2 === 1) {
45+
const [major, minor] = process.versions.node.split('.', 2).map((part) => Number(part));
46+
47+
if (major % 2 === 1) {
4848
// Allow new odd numbered releases with a warning (currently v17+)
4949
console.warn(
5050
'Node.js version ' +
@@ -55,13 +55,13 @@ if (version[0] % 2 === 1) {
5555
);
5656

5757
require('./bootstrap');
58-
} else if (version[0] < 20 || (version[0] === 20 && version[1] < 11)) {
59-
// Error and exit if less than 20.11
58+
} else if (major < 20 || (major === 20 && minor < 19) || (major === 22 && minor < 12)) {
59+
// Error and exit if less than 20.19 or 22.12
6060
console.error(
6161
'Node.js version ' +
6262
process.version +
6363
' detected.\n' +
64-
'The Angular CLI requires a minimum Node.js version of v20.11.\n\n' +
64+
'The Angular CLI requires a minimum Node.js version of v20.19 or v22.12.\n\n' +
6565
'Please update your Node.js version or visit https://nodejs.org/ for additional instructions.\n',
6666
);
6767

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.