1. Use NPM to Update Your Node Version
To update Node with NPM, you will install the n package, which will be used to interactively manage node versions on your device.
Here are the steps:
Clear the NPM cache
When you install dependencies, some modules are cached to improve the speed of installation in subsequent downloads. So first, you want to clear the NPM cache.
Install n
npm install -g n
You’ll need to install this package globally as it manages the Node versions at the root.
Install a new version of Node
n lts
n latest
The two commands above install the long-term support and latest versions of Node.
Remove previously installed versions
n prune
This command removes the cached versions of the previously installed versions and only keeps the latest installed version.