1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Change hard error to verbose warning if using old node.js level

This commit is contained in:
Nick O'Leary 2017-01-14 23:57:39 +00:00
parent d146ff8794
commit 4b64aad5ce
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
4 changed files with 16 additions and 6 deletions

View File

@ -77,7 +77,8 @@
"lostConnectionReconnect": "Lost connection to server, reconnecting in __time__s.", "lostConnectionReconnect": "Lost connection to server, reconnecting in __time__s.",
"lostConnectionTry": "Try now", "lostConnectionTry": "Try now",
"cannotAddSubflowToItself": "Cannot add subflow to itself", "cannotAddSubflowToItself": "Cannot add subflow to itself",
"cannotAddCircularReference": "Cannot add subflow - circular reference detected" "cannotAddCircularReference": "Cannot add subflow - circular reference detected",
"unsupportedVersion": "Using an unsupported version of Node.js<br/>You should upgrade to the latest Node.js LTS release"
} }
}, },
"clipboard": { "clipboard": {

View File

@ -27,12 +27,14 @@ var adminApp = null;
var server = null; var server = null;
var apiEnabled = false; var apiEnabled = false;
function checkVersion() { function checkVersion(userSettings) {
var semver = require('semver'); var semver = require('semver');
if (!semver.satisfies(process.version,">=4.0.0")) { if (!semver.satisfies(process.version,">=4.0.0")) {
var e = new Error("Unsupported version of node.js"); // TODO: in the future, make this a hard error.
e.code = "unsupported_version"; // var e = new Error("Unsupported version of node.js");
throw e; // e.code = "unsupported_version";
// throw e;
userSettings.UNSUPPORTED_VERSION = process.version;
} }
} }
@ -55,7 +57,7 @@ module.exports = {
} }
if (!userSettings.SKIP_BUILD_CHECK) { if (!userSettings.SKIP_BUILD_CHECK) {
checkVersion(); checkVersion(userSettings);
checkBuild(); checkBuild();
} }

View File

@ -102,6 +102,12 @@ function start() {
log.info(log._("runtime.version",{component:"Node-RED",version:"v"+settings.version})); log.info(log._("runtime.version",{component:"Node-RED",version:"v"+settings.version}));
} }
log.info(log._("runtime.version",{component:"Node.js ",version:process.version})); 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: ">=4"})+" *");
log.error("*****************************************************************");
events.emit("runtime-event",{id:"runtime-unsupported-version",type:"error",text:"notification.errors.unsupportedVersion"});
}
log.info(os.type()+" "+os.release()+" "+os.arch()+" "+os.endianness()); log.info(os.type()+" "+os.release()+" "+os.arch()+" "+os.endianness());
return redNodes.load().then(function() { return redNodes.load().then(function() {

View File

@ -2,6 +2,7 @@
"runtime": { "runtime": {
"welcome": "Welcome to Node-RED", "welcome": "Welcome to Node-RED",
"version": "__component__ version: __version__", "version": "__component__ version: __version__",
"unsupported_version": "Unsupported version of __component__. Requires: __requires__ Found: __version__",
"paths": { "paths": {
"settings": "Settings file : __path__" "settings": "Settings file : __path__"
} }