Appear to have iteratively broken my Node-RED installation, can someone give me a hand getting back on track?
First I tried to update node-red-contrib-virtual-smart-home via palette manager, but received an error about needing to upgrade npm as the version wasn't supported
so on my Ubuntu server, I ran sudo npm upgrade, it told me to then run nmp install -g npm, so I did that too then restarted Node-RED
now Node-RED doesn't show Palette Manager in the menu
I have tried to reinstall npm as follows: sudo npm install npm@latest -g
... however I get
npm does not support Node.js v10.19.0
You should probably upgrade to a newer version of node as we
can't make any promises that npm will work with this version.
so then I followed online instructions for upgrading Node.js, and I ran sudo apt update, then npm cache clean -f (again error that npm does not support Node.js v10.19.0), then npm install -g n
then sudo n stable, all of which gave me the same error as above, although the latter just gave "sudo: n: command not found"
For starters, do you really need n? Node.js version managers really mess you up unless you really know what you are doing.
While this approach might not suit everyone, my personal view is that you should take direct charge of your installations.
In your case, that probably means removing n and node.js and any Ubuntu installation of npm.
Then go to the node.js site and find the instructions for installing via a package manager. Add the library for node.js v16 or v14 if you want to be conservative. Then install. That should give you both node.js and npm of matching versions.
Since you were using n, you may need to reinstall node-red as well. In fact, it doesn't hurt anyway. After that, if any nodes are messed up, you can reinstall those as well. In fact, the easiest way to ensure everything is right is to delete your ~/.node-red/node_modules/ folder and then in ~/.node-red, just run npm install since the package.json file in that folder should still have all of the dependencies listed.
Ahh okay. You said " delete your ~/.node-red/node_modules/ folder and then in ~/.node-red, just run npm install"
Is that instead of the things you suggested before that point?
Given what you have said, sounds like it may be quicker to reinstall a new virtual machine and start with a clean Ubuntu from scratch... all from trying to update one contrib
To be clear, I don't think I had actually installed n - I always preferred to install each package myself in the OS rather than using version managers etc.... I was following instructions from some online tutorial. The command failed anyway...
Well, that shouldn't happen of course. And it doesn't. First rule rule when IT things go wrong is not to panic. Node.js application installations are logical. If there is a "fault" with Node-RED, it is that people don't learn the basics because for the most part Node-RED just works. But then if something odd does happen, you don't have the basics to fall back on that lets you understand what happened and how to recover.
OK, that should help. But the issue with Linux is that the versions of libraries and apps that are packaged in the default repositories aren't always the best or latest. Personally I prefer to use the repositories provided by a project if they are available.