Edit your ~/.node-red/package.json
, look under the dependencies section for ""~"0.1.40"
and replace it with "~0.1.40"
.
There was a bug in an older version of Node-RED when used with npm 7 that would cause this invalid version to be saved to the file.
If you're on the latest version of Node-RED, there's no reason not to use npm 7.