From ddc6ac45908f7aa2701ff5690eddc61a7887ccb5 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Wed, 5 Feb 2025 08:55:40 +0200 Subject: [PATCH] fix(server): improve tolerance for node version --- src/www.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/www.ts b/src/www.ts index d442ba35f..0ded22526 100644 --- a/src/www.ts +++ b/src/www.ts @@ -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); }