To upgrade NodeJS can be quite confusing. Do I use
Nvm? For a standard Laravel Forge server, NodeJS is installed with apt. When upgrading NodeJS to a newer version, you will want to upgrade only Node, and not everything on your server (scary!) which some blog posts suggests, hence this post. Just follow the steps below if you're on Forge server and want to upgrade your NodeJS version.
1 - Update NodeJS version in your sources.list to eg.
sudo nano /etc/apt/sources.list.d/nodesource.list
2 - Update sources:
sudo apt update
3 - Upgrade (only) NodeJS:
sudo apt install --only-upgrade nodejs
That's it! The last step is actually mentioned in the Laravel Forge Cookbook on how yo upgrade NodeJS, but it does not mention steps 1 and 2. If you just run the last command, you probably won't update anything.