mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #1979 from node-red/better-npm-check
refuse to enable palette if npm too old
This commit is contained in:
commit
d9aadf9d98
@ -235,13 +235,18 @@ function checkPrereq() {
|
|||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
} else {
|
} else {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
child_process.execFile(npmCommand,['-v'],function(err) {
|
child_process.execFile(npmCommand,['-v'],function(err,stdout) {
|
||||||
if (err) {
|
if (err) {
|
||||||
log.info(log._("server.palette-editor.npm-not-found"));
|
log.info(log._("server.palette-editor.npm-not-found"));
|
||||||
paletteEditorEnabled = false;
|
paletteEditorEnabled = false;
|
||||||
|
} else {
|
||||||
|
if (parseInt(stdout.split(".")[0]) < 3) {
|
||||||
|
log.info(log._("server.palette-editor.npm-too-old"));
|
||||||
|
paletteEditorEnabled = false;
|
||||||
} else {
|
} else {
|
||||||
paletteEditorEnabled = true;
|
paletteEditorEnabled = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
"loading": "Loading palette nodes",
|
"loading": "Loading palette nodes",
|
||||||
"palette-editor": {
|
"palette-editor": {
|
||||||
"disabled": "Palette editor disabled : user settings",
|
"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. Requires npm >= 3.x"
|
||||||
},
|
},
|
||||||
"errors": "Failed to register __count__ node type",
|
"errors": "Failed to register __count__ node type",
|
||||||
"errors_plural": "Failed to register __count__ node types",
|
"errors_plural": "Failed to register __count__ node types",
|
||||||
|
Loading…
Reference in New Issue
Block a user