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.",
"lostConnectionTry": "Try now",
"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": {

View File

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

View File

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