Upgrade Node.JS on a Rasperry Pi
When I wanted to upgrade my Ghost instance to the newest version I stumbled upon that my Node.JS version was too old: I was still using version 12. I did the standard apt update && apt upgrade to get the newest version of Node.JS on my Raspberry Pi: Unfortunately this did not work :(
The reason for this is, that the latest apt source is not in the apt list. So this needs to be added, which actually is quite easy to do.
Just run the following command
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
followed by the update & upgrade flow
sudo apt update sudo apt upgrade
After this you will have the newest version of Node.JS installed. You can verify it with:
And you should see a version number starting with 18.
If you want to upgrade/downgrade to a different Node.JS version, just change the setup_18.x to the corresponding version number you want.