Upgrade/Update All NPM Packages to the Latest Versions
In this short article, we are going to know how to update all NPM packages to the latest versions.
Table of Contents
Package Installation
We need to install a package named npm-check-updates globally. It upgrades your package.json dependencies to the latest versions, ignoring specified versions.
Install the package globally:
npm install -g npm-check-updates
Before upgrading all packages, have a look at the package notes:
- Maintains existing semantic versioning policies, i.e.
"express": "^4.0.0"
to"express": "^5.0.0"
. - Only modifies package.json file. Run
npm install
to update your installed packages and package-lock.json.
Check Available Versions
Show any new dependencies for the project in the current directory by typing ncu
command:
$ ncu
Checking package.json
[====================] 5/5 100%
express 4.12.x → 4.13.x
multer ^0.1.8 → ^1.0.1
react-bootstrap ^0.22.6 → ^0.24.0
react-a11y ^0.1.1 → ^0.2.6
webpack ~1.9.10 → ~1.10.5
Upgrade Versions
Now, run ncu -u
to upgrade package.json packages to the latest versions:
$ ncu -u
Upgrading package.json
[====================] 1/1 100%
express 4.12.x → 4.13.x
Run npm install
to install new versions.
Check Global Packages
To check global packages, run this command:
$ ncu -g
[====================] 5/5 100%
npm 7.20.3 → 7.20.5
ncu itself cannot upgrade global packages.
Run the following to upgrade all global packages:
npm -g install [email protected]
To know more about this package, have a look at their official repository.
That’s all. Thanks for reading. ?Comment
Preview may take a few seconds to load.
Markdown Basics
Below you will find some common used markdown syntax. For a deeper dive in Markdown check out this Cheat Sheet
Bold & Italic
Italics *asterisks*
Bold **double asterisks**
Code
Inline Code
`backtick`Code Block```
Three back ticks and then enter your code blocks here.
```
Headers
# This is a Heading 1
## This is a Heading 2
### This is a Heading 3
Quotes
> type a greater than sign and start typing your quote.
Links
You can add links by adding text inside of [] and the link inside of (), like so:
Lists
To add a numbered list you can simply start with a number and a ., like so:
1. The first item in my list
For an unordered list, you can add a dash -, like so:
- The start of my list
Images
You can add images by selecting the image icon, which will upload and add an image to the editor, or you can manually add the image by adding an exclamation !, followed by the alt text inside of [], and the image URL inside of (), like so:
Dividers
To add a divider you can add three dashes or three asterisks:
--- or ***

Comments (0)