Update August 2021
On a stock Linux Mint computer npm and node was outdated. Before
➜ npx -v
➜ npm -v
➜ node -v
Command to update NPM:
sudo npm install -g [email protected]
➜ npm -v
Command used to update Node:
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
node -v still gave the old version. Here was the hack fix:
rm: remove write-protected regular file ‘/usr/local/bin/node’? y
rm: cannot remove ‘/usr/local/bin/node’: Permission denied
➜ code sudo rm /usr/local/bin/node
[sudo] password for user:
So we had to actually delete node and only then did it find the new version in the path.
➜ code node -v
Still very complicated to update node, but NPM is better.
Contents of Old Article
Installing node and npm and even yarn on Ubuntu Linux or Linux Mint can be a nightmare because the usual ‘apt get’ commands do not work properly and want to install really old versions. The problem is once you’re stuck with these old version you have to go through a whole rigmarole to upgrade so it’s just not the effort the use the built-in apt version.
Instead you have to go to a little wild goose chase via the Node website. There you will find easily download instructions – but not install instructions. Instead you have to hunt deeper down and then you will find some more breadcrumbs. Here’s the cinch – you want the LTS version, and not the “Latest Version”. This is the most important thing to take note of. Life is too short for “Latest Version” in this case.
From the Node website you’ll be going to the Nodesource website. There you will find these instructions:
# Using Ubuntu curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - sudo apt-get install -y nodejs
Once you have done the above out of the blue pops up the proper yarn instructions which you might want to proceed with. It seems alas that the default apt version of Yarn on Ubuntu is also an issue so follow the guide instead of apt.
The wild goose chase goes to: