How to Update Node.js and NPM to the Latest Version (2025)
Last Updated :
11 Apr, 2025
Updating Node.js and NPM to the latest version ensures the newest features, performance improvements, and security updates. This article will guide you through the steps to update Node.js and npm to the latest version on various operating systems, including Windows, macOS, and Linux.
Different Methods to Update Node.js and NPM
To update Node and NPM to the latest versions we can use various methods like nvm (node version manager), node.js Windows installer, npm, and homebrew for macOS.
Why Update Node.js and NPM?
- Security Patches: Protect against vulnerabilities.
- Performance Boosts: Faster execution for apps and tools.
- New Features: Access modern JavaScript capabilities.
- Compatibility: Avoid errors with outdated dependencies.
Check the Installed node version
Before updating, it’s helpful to check your current Node.js version:
node -v
current installed versionMethod 1: Using NVM (Node Version Manager)
Step 1: Install NVM on your system, and verify nvm installation
nvm -v
Step 2: Use the following command to install and update Node to the latest version.
nvm install node
With the above command the compatible NPM version will be automatically installed (e.g. npm v10 with node v22)
Step 3: After installing run this command to use the version mentioned in above response (v22 for now).
nvm use 22
Using NVM you can easily use any version of node if required
- Check the list of available Node.js versions in the system using the following command.
nvm list
- To use the desired version, use the following command:
nvm use <version>
Method 2: Using the Node.js Installer (Windows and macOS)
Follow these steps to install Node.js on Windows using the Nodejs Installer.
Step 1: Download Installer by Visiting Node.js official website .
Step 2: Run Installer by Opening the downloaded installer. Follow the on-screen instructions to complete the installation.
Step 3: Verify Installation
node -v
node version in windowsUpdate npm using NPM
Step 4: Use below npm command to upgrade npm to latest
npm install -g npm@latest
Step 5: Verify latest Installation update
npm -v
Method 3: Using Homebrew on macOS
Homebrew is a popular package manager for macOS that simplifies the process of managing software installations, including Node.js.
Step 1: Install Homebrew by Visiting brew.sh and follow the installation instructions.
Step 2: brew update
brew update
Step 3: Install Node.js
brew install node
Step 4: Update Node.js
brew upgrade node
Step 5: Verify latest Installation update
node -v
Also Read:
Conclusion
Updating Node.js and NPM regularly ensures you have the latest features, bug fixes, and security updates. Whether you prefer using NVM, the Node.js installer, or Homebrew, these methods make it easy to stay up-to-date. Choose the method that best fits your operating system and workflow.