How to update Node.js or npm to latest version
Update Node.js on Windows or Linux
For Windows
For Windows users, Please use the official installers from the offical Node.js site.
Which is more reliable and easier.
Or you can use Chocolatey if you have it installed.
choco install nodejs-lts
For a specific version,
choco install nodejs-lts --version="20.17.0"
For Linux
For Linux and MacOS users, The Easiest way to update Node.js is to use nvm
.
Install nvm
using the following command
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
Now, To install the latest version of Node.js with nvm, Use the following command.
nvm install node
If you want a specific version of Node.js, You can also do that with nvm
nvm install 20.17.0
Update npm command
You can install the latest version of npm
with the npm package manager itself.
Use the following command.
npm update -g npm
⚠️
This will remove your existing npm version and reinstall the latest version.
Last updated on