[New user] Error installing dashboard

Unable to download dashboard, error is as such..

15 May 03:37:05 - [info] Server now running at http://127.0.0.1:1880/
15 May 03:37:05 - [info] Starting flows
15 May 03:37:05 - [info] Started flows
15 May 03:37:54 - [info] Installing module: node-red-dashboard, version: 3.1.7
15 May 03:37:59 - [warn] Installation of module node-red-dashboard failed:
15 May 03:37:59 - [warn] ------------------------------------------
15 May 03:37:59 - [warn] npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name ""~"5.21.2": Tags may not have any characters that encodeURIComponent encodes.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2022-05-14T19_37_55_635Z-debug-0.log
15 May 03:37:59 - [warn] ------------------------------------------
Error: Install failed
    at /usr/lib/node_modules/node-red/node_modules/@node-red/registry/lib/installer.js:285:25
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
15 May 03:37:59 - [error] Error: Install failed

Any help would be appreciated.

How did you attempt to install node-red-dashboard?
Did you used the 'Manage Palette', use the cmd npm install node-red-dashboard, or something else?

Yes I tried installing using both manage palette and through console as well! Both returned the same error.

Sorry i would like to edit my post, when i type it in console it gives

pi@raspberrypi:~ $ npm install node-red-dashboard

up to date, audited 160 packages in 4s

found 0 vulnerabilities

What am i supposed to do upon seeing this^?

You did not run this in the right directory - you should be in the .node-red directory.

But you will hit the same error when you try.

What version of Node-RED are you using? There was a bug in an 2.something release that caused the issue you are hitting.

You need to edit the file ~/.node-red/package.json, look in the dependencies section for an entry like "\"~\"5.21.2". Edit it to get rid of the extra quotes: "~5.21.2"

You should find the installs work again.

If not, please share the contents of package.json so we can see if any further fixes are needed.

Dear knolleary,

The version of Node-Red I am using is v2.2.2, hopefully it isn't the version with a bug.

I have also tried editing this

but my results were

pi@raspberrypi:~ $ ~/.node-red/package.json
bash: /home/pi/.node-red/package.json: Permission denied

I have since tried installing the dashboard from the node-red directory, and it can be confirmed now that the error returned are the same.

pi@raspberrypi:~/.node-red $ npm i node-red-dashboard
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name ""~"5.21.2": Tags may not have any characters that encodeURIComponent encodes.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2022-05-14T22_04_45_749Z-debug-0.log

That isn't editing it... You have tried to run it.

You need to open the file in a text editor to make changes.

I would strongly recommend familiarising yourself with at least some basic command line stuff, otherwise you could end up trashing your system.

https://ubuntu.com/tutorials/command-line-for-beginners#1-overview
https://www.circuitbasics.com/how-to-edit-text-files-on-a-raspberry-pi/

Terribly sorry making a mess, have edited it and it works now. Many thanks!

Yes would definitely give it a good read, thank you for sharing.