Skip to content

Commit b2a2253

Browse files
committed
feat(react-scripts): check Node.js version early in CLI (#5430)
1 parent 46732f2 commit b2a2253

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/react-scripts/bin/react-scripts.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@
88

99
'use strict';
1010

11+
// Check Node.js version early for clearer errors (see #5430)
12+
const currentNodeVersion = process.versions.node;
13+
const [major] = currentNodeVersion.split('.');
14+
if (Number(major) < 14) {
15+
console.error(
16+
'You are running Node ' +
17+
currentNodeVersion +
18+
'.\n' +
19+
'react-scripts requires Node 14 or higher. \n' +
20+
'Please update your version of Node.'
21+
);
22+
process.exit(1);
23+
}
24+
1125
// Makes the script crash on unhandled rejections instead of silently
1226
// ignoring them. In the future, promise rejections that are not handled will
1327
// terminate the Node.js process with a non-zero exit code.

0 commit comments

Comments
 (0)