fix(cli): require Node.js 20.19+ or 22.12+ and say so instead of crashing with ERR_REQUIRE_ESM

pull/242/head
paul 2026-10-31 21:10:09 +01:00
parent 1d67af1558
commit fff3ebf9a3
2 changed files with 8 additions and 1 deletions

View File

@ -2,4 +2,11 @@
'use strict'; 'use strict';
// The CLI loads ES-module-only dependencies (chalk, inquirer) with require(),
// which Node.js supports from 20.19 and 22.12 on.
if (!process.features.require_module) {
console.error(`config-sync: the CLI needs a Node.js that can require() ES modules: 20.19+ or 22.12+ (current: ${process.version}).`);
process.exit(1);
}
require('../dist/cli'); require('../dist/cli');

View File

@ -136,7 +136,7 @@
}, },
"homepage": "https://www.pluginpal.io/plugin/config-sync", "homepage": "https://www.pluginpal.io/plugin/config-sync",
"engines": { "engines": {
"node": ">=20.0.0 <=24.x.x", "node": "^20.19.0 || >=22.12.0 <=24.x.x",
"npm": ">=6.0.0" "npm": ">=6.0.0"
}, },
"license": "MIT", "license": "MIT",