Some people often confuses with NPM update vs Node.js update.
NVM (Node Version Manager) and n are command line utilities to manage and switch between Node.js versions.
When you are installed for the first time, you will be installing Node.js from https://nodejs.org/en/download/ which also installs NPM CLI utility.
But when upgrading the NPM or Node.js, it's a different story.
npm install -g npm
Update Node.js with Node version manager (n)
Install the n
sudo npm install -g n
Update the Node.js to stable version
sudo n stable
As of now, the stable version is 16.3.2 which includes NPM 8.1.2
Update the Node.js to current version
sudo n current
As of now, the current version is 17.4.0 with NPM 8.3.1
Check the versions
Hope this helps you to understand the NPM and Node.js difference along with update of individual components.
Send your comments and feedback to firstname.lastname@example.org