You've successfully subscribed to StackInk
Great! Next, complete checkout for full access to StackInk
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.

How to Update All NPM Packages to the Latest Versions in One Go

Updating your npm packages to the latest versions is crucial for staying up-to-date with security fixes, performance improvements, and new features. However, managing all your project's packages can be a challenge. In this article, we'll explore ways to quickly update all npm packages to their latest versions, making your development workflow smoother and more efficient.

Method 1: Using the "npm-check-updates" package

First, install the "npm-check-updates" package globally by running the following command:

npm install -g npm-check-updates

Next, navigate to your project's root directory and run the following command:


This command will display a list of outdated packages and their latest versions. To update all the packages, run:

ncu -u

Lastly, install the updated packages using:

npm install

Method 2: Using the "npm-outdated" command

Navigate to your project's root directory and run:

npm outdated

This command will display a list of outdated packages. To update each package individually, run:

npm install <package_name>@latest

Replace "<package_name>" with the actual package name.

If you prefer to update all packages at once, you can use a script like this:

npm outdated --parseable | cut -d: -f4 | xargs -I% npm install %@latest

Method 3: Updating package.json manually

Open your project's "package.json" file and locate the "dependencies" and "devDependencies" sections.
Replace the current version number of each package with an asterisk (*) or "latest", like so:

"dependencies": {	
	"package_name": "*"

Save the file and run the following command to update all packages:

npm update

Keeping your npm packages up-to-date is essential to maintaining a secure and efficient development environment. With these three methods, you can easily update all npm packages to their latest versions, ensuring that your projects stay current with the latest improvements and features. Make sure to test your application after updating packages to ensure compatibility and avoid potential issues. Happy coding!