Summary
To check for outdated global packages, enter the following command in your terminal:
npm outdated -g --depth=0
To update all global packages, enter the following command in your terminal:
npm update -g
To update a single global package, enter the following command in your terminal:
npm update -g package-name
Details
Check for outdated packages
Before updating any packages, you should first check which global packages are outdated. To do this, enter the following command in your terminal:
npm outdated -g --depth=0
If you have any outdated global packages, you should see something like the following print out. In this example, the gatsby-cli
package is out-of-date.
Package Current Wanted Latest Location
gatsby-cli 2.6.4 2.7.39 2.7.39
Update a single global package
If you want to update a specific global package, you can add the name of the package to the command. For example, if you wanted to update the gatsby-cli
package, you would enter the following command in your terminal:
npm update -g gatsby-cli
If you updated gatsby-cli
correctly, you should see something similar to the following print out to your terminal (your version number may be different):
+ gatsby-cli@2.7.39
added 21 packages from 10 contributors and updated 38 packages in 6.49s
You can run the npm outdated -g --depth=0
command one more time to make sure the package was updated.
Update all global packages
If you want to update all of your outdated global packages at once, enter the following command in your terminal:
npm update -g
Exercises
There are no exercises for this lesson.