From 514e31aef9098bab1ace39caaf0252bde0f2a3e3 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 14 Nov 2018 18:29:27 +0000 Subject: [PATCH 1/2] refuse to enable palette if npm too old --- .../node_modules/@node-red/registry/lib/installer.js | 9 +++++++-- .../@node-red/runtime/locales/en-US/runtime.json | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/node_modules/@node-red/registry/lib/installer.js b/packages/node_modules/@node-red/registry/lib/installer.js index 66768a620..c5095236e 100644 --- a/packages/node_modules/@node-red/registry/lib/installer.js +++ b/packages/node_modules/@node-red/registry/lib/installer.js @@ -235,12 +235,17 @@ function checkPrereq() { return Promise.resolve(); } else { return new Promise(resolve => { - child_process.execFile(npmCommand,['-v'],function(err) { + child_process.execFile(npmCommand,['-v'],function(err,stdout) { if (err) { log.info(log._("server.palette-editor.npm-not-found")); paletteEditorEnabled = false; } else { - paletteEditorEnabled = true; + if (parseInt(stdout.split(".")[0]) < 3) { + log.info(log._("server.palette-editor.npm-too-old")); + paletteEditorEnabled = false; + } else { + paletteEditorEnabled = true; + } } resolve(); }); diff --git a/packages/node_modules/@node-red/runtime/locales/en-US/runtime.json b/packages/node_modules/@node-red/runtime/locales/en-US/runtime.json index 8d47d8215..9fbf5f029 100644 --- a/packages/node_modules/@node-red/runtime/locales/en-US/runtime.json +++ b/packages/node_modules/@node-red/runtime/locales/en-US/runtime.json @@ -13,7 +13,8 @@ "loading": "Loading palette nodes", "palette-editor": { "disabled": "Palette editor disabled : user settings", - "npm-not-found": "Palette editor disabled : npm command not found" + "npm-not-found": "Palette editor disabled : npm command not found", + "npm-too-old": "Palette editor disabled : npm version too old - please update" }, "errors": "Failed to register __count__ node type", "errors_plural": "Failed to register __count__ node types", From abe746020b0a3ab0559ca8a448ee9b1df676b4b8 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 5 Dec 2018 13:48:39 +0000 Subject: [PATCH 2/2] Update packages/node_modules/@node-red/runtime/locales/en-US/runtime.json Co-Authored-By: dceejay --- .../node_modules/@node-red/runtime/locales/en-US/runtime.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/runtime/locales/en-US/runtime.json b/packages/node_modules/@node-red/runtime/locales/en-US/runtime.json index 9fbf5f029..d56031d2f 100644 --- a/packages/node_modules/@node-red/runtime/locales/en-US/runtime.json +++ b/packages/node_modules/@node-red/runtime/locales/en-US/runtime.json @@ -14,7 +14,7 @@ "palette-editor": { "disabled": "Palette editor disabled : user settings", "npm-not-found": "Palette editor disabled : npm command not found", - "npm-too-old": "Palette editor disabled : npm version too old - please update" + "npm-too-old": "Palette editor disabled : npm version too old. Requires npm >= 3.x" }, "errors": "Failed to register __count__ node type", "errors_plural": "Failed to register __count__ node types",