Palette Manager installation leave invalid tag in package.json

Node-red version 1.2.2 new Palette Manager installation leave invalid tag in package.json.
This cause error on any further npm installation.
2020-11-03T05:04:29.804Z [err] ERR! Invalid tag name ""~"0.0.3": Tags may not have any characters that encodeURIComponent encodes.

What version of npm and node.js are you using?

We saw one instance of this happen recently with npm 7 - which was only published two weeks ago. But we haven't been able to reproduce.

Node v15.0.1
npm version 7.0.3

Ok - so there is definitely something wrong with npm 7 - it is responsible for updating the package.json file, we don't do that ourselves.

Do you know what steps you took that led to the invalid version string being added to the file?

The strange thing is if I manually use npm command to install any package it works ok.
It is the same command I copied from the Palette manager action log.
For example I just tried: npm install --no-audit --no-update-notifier --no-fund --save --save-prefix="~" --production node-red-contrib-binary@0.1.3
Any install initiated by palette manager will have the problem.
Do you think problem is at the browser side?

No. npm is the only thing that updates the package.json file. There is something specific about how we invoke it.

But just as you have, I have manually run exactly the same command node-red uses to install the module and the package.json was updated correctly.

This is why I asked if you know exactly what steps you took to hit this issue. I wonder if its a particular sequence of steps rather than just running the one-off command.

It is a fresh install of Dietpi v6.33.3 on top of Raspberry Pi 3 B+, with only Node-Red and Mosquito installed and Bluetooth enabled. After that use palette manager to install package got the problem. I even repeat a fresh install again and meet with the same problem.

I wonder if it's the --save-prefix="~" option ? (that should be valid but...)
any chance you can try that on the command line ?

It is as if the save-prefix is getting passed including the quotes when run from the palette, so the command is actually seeing --save-prefix='"~"' or '\"~\"'for some reason.


You are right! The following command re-created the same issue as install from the palette.
npm install --no-audit --no-update-notifier --no-fund --save --save-prefix='"~"' --production node-red-contrib-binary@0.1.3

I tried on the command line.
npm install --no-audit --no-update-notifier --no-fund --save --save-prefix="~" --production node-red-contrib-binary@0.1.3 installed properly.
Then as Colin suggest, I try:
npm install --no-audit --no-update-notifier --no-fund --save --save-prefix='"~"' --production node-red-contrib-binary@0.1.3 problem show up "\"~\"0.1.3" in the package.json.
So install from the palette is actually running the second command.

I don't think that proves that is what is happening, just that it is a possibility.

Anyone find a fix for this? I just did a new install on windows with same issues.
Odd thing though, I was able to install "node-red-contrib-home-assistant-websocket 0.27.4" without any problem. Nothing else i have tried will install via pallet manager. Maybe there is a clue there.
Ok , I don't know if this helps anyone that's smarter than me to figure this out, but i uninstalled the one node package that i was able to install earlier and then i was able to install another random node via the pallet manager. But as soon as i tried to install yet another it gave same invalid tag error, except it referenced the previously installed node. It seems once you install one node or node group then it starts throwing the error and will not allow any more installs . And in my case, i cant install via the command line either, when i try it gives the same error as it does with the pallet manager install.
Hope this helps.

I was able to correct the issue by rolling back npm to 6.14.8 with this command for anyone else with this issue.
npm install -g npm@6.14.8

If you edit the package.json and package-lock.json, remove the extra \" in the version section.
You could use palette again to install new packages.
Just need to keep editing the above two files every time after new install.

Yes, as has been stated earlier, the problem is with npm 7, so the best thing is to avoid installing that in the first place.

we hope to have a fix in 1.2.3 imminently.


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.