From a5223709bad9f9f1588057bd2dffa44f68a8f2d0 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 19 Feb 2024 16:38:06 +0000 Subject: [PATCH] Bump minimum version to node 18 --- .github/workflows/tests.yml | 8 +------- package.json | 2 +- packages/node_modules/@node-red/runtime/lib/index.js | 2 +- packages/node_modules/node-red/lib/red.js | 3 +-- packages/node_modules/node-red/package.json | 2 +- packages/node_modules/node-red/red.js | 9 ++++++++- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a20b8ae14..8e010c63e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,12 +12,11 @@ permissions: jobs: build: permissions: - checks: write # for coverallsapp/github-action to create new checks contents: read # for actions/checkout to fetch code runs-on: ubuntu-latest strategy: matrix: - node-version: [16, 18, 20] + node-version: [18, 20] steps: - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} @@ -29,8 +28,3 @@ jobs: - name: Run tests run: | npm run test - # - name: Publish to coveralls.io - # if: ${{ matrix.node-version == 16 }} - # uses: coverallsapp/github-action@v1.1.2 - # with: - # github-token: ${{ github.token }} diff --git a/package.json b/package.json index c4770170f..9943d3203 100644 --- a/package.json +++ b/package.json @@ -122,6 +122,6 @@ "supertest": "6.3.3" }, "engines": { - "node": ">=14" + "node": ">=18" } } diff --git a/packages/node_modules/@node-red/runtime/lib/index.js b/packages/node_modules/@node-red/runtime/lib/index.js index 39b2025c5..7fc9af041 100644 --- a/packages/node_modules/@node-red/runtime/lib/index.js +++ b/packages/node_modules/@node-red/runtime/lib/index.js @@ -154,7 +154,7 @@ function start() { log.info(log._("runtime.version",{component:"Node.js ",version:process.version})); if (settings.UNSUPPORTED_VERSION) { log.error("*****************************************************************"); - log.error("* "+log._("runtime.unsupported_version",{component:"Node.js",version:process.version,requires: ">=8.9.0"})+" *"); + log.error("* "+log._("runtime.unsupported_version",{component:"Node.js",version:process.version,requires: ">=18"})+" *"); log.error("*****************************************************************"); events.emit("runtime-event",{id:"runtime-unsupported-version",payload:{type:"error",text:"notification.errors.unsupportedVersion"},retain:true}); } diff --git a/packages/node_modules/node-red/lib/red.js b/packages/node_modules/node-red/lib/red.js index a48de47d7..93c983ce3 100644 --- a/packages/node_modules/node-red/lib/red.js +++ b/packages/node_modules/node-red/lib/red.js @@ -33,8 +33,7 @@ if (NODE_MAJOR_VERSION >= 16) { function checkVersion(userSettings) { var semver = require('semver'); - if (!semver.satisfies(process.version,">=14.0.0")) { - // TODO: in the future, make this a hard error. + if (!semver.satisfies(process.version,">=18.0.0")) { // var e = new Error("Unsupported version of Node.js"); // e.code = "unsupported_version"; // throw e; diff --git a/packages/node_modules/node-red/package.json b/packages/node_modules/node-red/package.json index 45ae1088d..9e54ad381 100644 --- a/packages/node_modules/node-red/package.json +++ b/packages/node_modules/node-red/package.json @@ -47,6 +47,6 @@ "bcrypt": "5.1.0" }, "engines": { - "node": ">=14" + "node": ">=18" } } diff --git a/packages/node_modules/node-red/red.js b/packages/node_modules/node-red/red.js index 63c0188bd..85b5aec48 100755 --- a/packages/node_modules/node-red/red.js +++ b/packages/node_modules/node-red/red.js @@ -26,6 +26,13 @@ if (process.argv[2] === 'admin') { return; } +var semver = require('semver'); +if (!semver.satisfies(process.version, ">=18.0.0")) { + console.log("Unsupported version of Node.js:", process.version); + console.log("Node-RED requires Node.js v18 or later"); + process.exit(1) +} + var http = require('http'); var https = require('https'); var util = require("util"); @@ -346,7 +353,7 @@ httpsPromise.then(function(startupHttps) { } catch(err) { if (err.code == "unsupported_version") { console.log("Unsupported version of Node.js:",process.version); - console.log("Node-RED requires Node.js v8.9.0 or later"); + console.log("Node-RED requires Node.js v18 or later"); } else { console.log("Failed to start server:"); if (err.stack) {