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

npm: Remove production flag on npm invocation

When installing packages the `--production` flag used to be added to the
arguments that `npm` received. As npm wants developers to use the
`--omit=dev` flag instead it warned users on STDERR. Standard error was
captured by Node-RED and output to the logs as being an error. This
caught users off-guard and they expected something to have gone
wrong.

With this change the `--omit=dev` is used instead, to remove the
warning.

This change works for NPM of version 8 and beyond[1], included in
Node.JS 16. This change will not work on NPM version 6[2] which is included
in Node.JS 14[3].

[1]: https://docs.npmjs.com/cli/v8/commands/npm-install#omit
[2]: https://docs.npmjs.com/cli/v6/commands/npm-install
[3]: https://nodejs.org/en/download/releases#looking-for-latest-release-of-a-version-branch
This commit is contained in:
ZJ van de Weg 2023-09-17 08:22:15 +02:00
parent cef3a01042
commit 54d4079457
2 changed files with 2 additions and 2 deletions

View File

@ -263,7 +263,7 @@ async function installModule(moduleDetails) {
"module": moduleDetails.module, "module": moduleDetails.module,
"version": moduleDetails.version, "version": moduleDetails.version,
"dir": installDir, "dir": installDir,
"args": ["--production","--engine-strict"] "args": ["--omit=dev","--engine-strict"]
} }
return hooks.trigger("preInstall", triggerPayload).then((result) => { return hooks.trigger("preInstall", triggerPayload).then((result) => {
// preInstall passed // preInstall passed

View File

@ -215,7 +215,7 @@ async function installModule(module,version,url) {
"dir": installDir, "dir": installDir,
"isExisting": isExisting, "isExisting": isExisting,
"isUpgrade": isUpgrade, "isUpgrade": isUpgrade,
"args": ['--no-audit','--no-update-notifier','--no-fund','--save','--save-prefix=~','--production','--engine-strict'] "args": ['--no-audit','--no-update-notifier','--no-fund','--save','--save-prefix=~','--omit=dev','--engine-strict']
} }
return hooks.trigger("preInstall", triggerPayload).then((result) => { return hooks.trigger("preInstall", triggerPayload).then((result) => {