Skip to content

Commit a86270f

Browse files
authored
fix: add node version check (#1007)
1 parent 835eb77 commit a86270f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

codex-cli/src/cli.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
#!/usr/bin/env node
22
import "dotenv/config";
33

4+
// Exit early if on an older version of Node.js (< 22)
5+
const major = process.versions.node.split(".").map(Number)[0]!;
6+
if (major < 22) {
7+
// eslint-disable-next-line no-console
8+
console.error(
9+
"\n" +
10+
"Codex CLI requires Node.js version 22 or newer.\n" +
11+
`You are running Node.js v${process.versions.node}.\n` +
12+
"Please upgrade Node.js: https://nodejs.org/en/download/\n",
13+
);
14+
process.exit(1);
15+
}
16+
417
// Hack to suppress deprecation warnings (punycode)
518
// eslint-disable-next-line @typescript-eslint/no-explicit-any
619
(process as any).noDeprecation = true;

0 commit comments

Comments
 (0)