From 02a5a39caf15dd47edfe0c6cac46b44071b1c429 Mon Sep 17 00:00:00 2001 From: Tom Tarpey Date: Wed, 20 Dec 2023 16:42:48 +0000 Subject: [PATCH] Update start.js fix to allow old and new versiond of nodejs to be used --- start.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/start.js b/start.js index d95d89efe..d8808a90e 100644 --- a/start.js +++ b/start.js @@ -1,7 +1,13 @@ const { spawn } = require("child_process"); const { Buffer } = require("buffer"); - -const ls = spawn(/^win/.test(process.platform) ? 'npx.cmd' : 'npx', ['craco', '--max_old_space_size=4096', '--openssl-legacy-provider', 'start']); + +const nodeVersion = process.version; +const majorVersion = parseInt(nodeVersion.slice(1).split('.')[0], 10); +let cmdArray = []; + +majorVersion < 17 ? cmdArray = ['craco', '--max_old_space_size=4096', 'start'] : cmdArray = ['craco', '--max_old_space_size=4096', '--openssl-legacy-provider', 'start'] + +const ls = spawn(/^win/.test(process.platform) ? 'npx.cmd' : 'npx', cmdArray); ls.stdout.on("data", data => { console.log(`${data}`);