Updating packages downloaded from the registry | npm Docs (2024)

Table of contents

Updating local and global packages you downloaded from the registry helps keep your code and tools stable, usable, and secure.

Updating local packages

We recommend regularly updating the local packages your project depends on to improve your code as improvements to its dependencies are made.

  1. Navigate to the root directory of your project and ensure it contains a package.json file:

    cd /path/to/project
  2. In your project root directory, run the update command:

    npm update
  3. To test the update, run the outdated command. There should not be any output.

    npm outdated

Updating globally-installed packages

Note: If you are using npm version 2.6.0 or less, run this script to update all outdated global packages.

However, please consider upgrading to the latest version of npm:

npm install npm@latest -g

Determining which global packages need updating

To see which global packages need to be updated, on the command line, run:

npm outdated -g --depth=0

Updating a single global package

To update a single global package, on the command line, run:

npm update -g <package_name>

Updating all globally-installed packages

To update all global packages, on the command line, run:

npm update -g

Resources

CLI commands

Updating packages downloaded from the registry | npm Docs (2024)
Top Articles
Latest Posts
Article information

Author: Saturnina Altenwerth DVM

Last Updated:

Views: 5881

Rating: 4.3 / 5 (64 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Saturnina Altenwerth DVM

Birthday: 1992-08-21

Address: Apt. 237 662 Haag Mills, East Verenaport, MO 57071-5493

Phone: +331850833384

Job: District Real-Estate Architect

Hobby: Skateboarding, Taxidermy, Air sports, Painting, Knife making, Letterboxing, Inline skating

Introduction: My name is Saturnina Altenwerth DVM, I am a witty, perfect, combative, beautiful, determined, fancy, determined person who loves writing and wants to share my knowledge and understanding with you.