fix(server): improve tolerance for node version

This commit is contained in:
Elian Doran 2025-02-05 08:55:40 +02:00
parent 0d62493b77
commit ddc6ac4590
No known key found for this signature in database

View File

@ -13,7 +13,7 @@ import utils from "./services/utils.js";
import port from "./services/port.js";
import host from "./services/host.js";
const MINIMUM_NODE_VERSION = "22.0.0";
const MINIMUM_NODE_VERSION = "20.0.0";
// setup basic error handling even before requiring dependencies, since those can produce errors as well
@ -33,8 +33,12 @@ function exit() {
process.on("SIGINT", exit);
process.on("SIGTERM", exit);
if (utils.compareVersions(process.version, MINIMUM_NODE_VERSION) < 0) {
console.error(`\nTrilium requires Node.js ${MINIMUM_NODE_VERSION} and later.\n`);
if (utils.compareVersions(process.versions.node, MINIMUM_NODE_VERSION) < 0) {
console.error();
console.error(`The Trilium server requires Node.js ${MINIMUM_NODE_VERSION} and later in order to start.\n`);
console.error(`\tCurrent version:\t${process.versions.node}`);
console.error(`\tExpected version:\t${MINIMUM_NODE_VERSION}`);
console.error();
process.exit(1);
}