Uninstalling packages and dependencies | npm Docs (2024)

Table of contents

If you no longer need to use a package in your code, we recommend uninstalling it and removing it from your project's dependencies.

Uninstalling local packages

Removing a local package from your node_modules directory

To remove a package from your node_modules directory, on the command line, use the uninstall command. Include the scope if the package is scoped.

This uninstalls a package, completely removing everything npm installed on its behalf.

It also removes the package from the dependencies, devDependencies, optionalDependencies, and peerDependencies objects in your package.json.

Further, if you have an npm-shrinkwrap.json or package-lock.json, npm will update those files as well.

Unscoped package

npm uninstall <package_name>

Scoped package

npm uninstall <@scope/package_name>

Example

npm uninstall lodash

Removing a local package without removing it from package.json

Using the --no-save will tell npm not to remove the package from your package.json, npm-shrinkwrap.json, or package-lock.json files.

Example

npm uninstall --no-save lodash

--save or -S will tell npm to remove the package from your package.json, npm-shrinkwrap.json, and package-lock.json files. This is the default, but you may need to use this if you have for instance save=false in your .npmrc file.

Confirming local package uninstallation

To confirm that npm uninstall worked correctly, check that the node_modules directory no longer contains a directory for the uninstalled package(s).

  • Unix system (such as OSX): ls node_modules
  • Windows systems: dir node_modules

Uninstalling global packages

To uninstall an unscoped global package, on the command line, use the uninstall command with the -g flag. Include the scope if the package is scoped.

Unscoped package

npm uninstall -g <package_name>

Scoped package

npm uninstall -g <@scope/package_name>

Example

For example, to uninstall a package called jshint, run:

npm uninstall -g jshint

Resources

Uninstalling local packages

Uninstalling global packages

Edit this page on GitHub

3 contributorsUninstalling packages and dependencies | npm Docs (1)lukekarrysUninstalling packages and dependencies | npm Docs (2)ericrallenUninstalling packages and dependencies | npm Docs (3)ethomson

Last edited by lukekarrys on October 23, 2023

Uninstalling packages and dependencies | npm Docs (2024)
Top Articles
How To Choose The Best Travel Card In 5 Steps | Bankrate
Top Professional Finance Certifications 2024 - Financial Edge
Ups Customer Center Locations
Lengua With A Tilde Crossword
NYT Mini Crossword today: puzzle answers for Tuesday, September 17 | Digital Trends
Was ist ein Crawler? | Finde es jetzt raus! | OMT-Lexikon
Mountain Dew Bennington Pontoon
Tesla Supercharger La Crosse Photos
10 Popular Hair Growth Products Made With Dermatologist-Approved Ingredients to Shop at Amazon
Academic Integrity
Craigslist Pet Phoenix
Localfedex.com
Dr Klabzuba Okc
Hay day: Top 6 tips, tricks, and cheats to save cash and grow your farm fast!
Steve Strange - From Punk To New Romantic
Citi Card Thomas Rhett Presale
Catsweb Tx State
Lqse-2Hdc-D
Shariraye Update
Our Facility
Oscar Nominated Brings Winning Profile to the Kentucky Turf Cup
I Touch and Day Spa II
Les Rainwater Auto Sales
Bend Pets Craigslist
Craigslistjaxfl
Lehmann's Power Equipment
Sprinkler Lv2
Missed Connections Inland Empire
Metro Pcs.near Me
Craigslist Maui Garage Sale
Gazette Obituary Colorado Springs
Loslaten met de Sedona methode
Vivaciousveteran
Safeway Aciu
Leben in Japan &#8211; das muss man wissen - Lernen Sie Sprachen online bei italki
Grave Digger Wynncraft
130Nm In Ft Lbs
Allegheny Clinic Primary Care North
Mastering Serpentine Belt Replacement: A Step-by-Step Guide | The Motor Guy
Manuel Pihakis Obituary
Ixlggusd
Palmadise Rv Lot
Glossytightsglamour
All Things Algebra Unit 3 Homework 2 Answer Key
Hisense Ht5021Kp Manual
ATM Near Me | Find The Nearest ATM Location | ATM Locator NL
Pawn Shop Open Now
Sig Mlok Bayonet Mount
Ds Cuts Saugus
Sinai Sdn 2023
Marcel Boom X
Page 5747 – Christianity Today
Latest Posts
Article information

Author: Duane Harber

Last Updated:

Views: 6470

Rating: 4 / 5 (51 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Duane Harber

Birthday: 1999-10-17

Address: Apt. 404 9899 Magnolia Roads, Port Royceville, ID 78186

Phone: +186911129794335

Job: Human Hospitality Planner

Hobby: Listening to music, Orienteering, Knapping, Dance, Mountain biking, Fishing, Pottery

Introduction: My name is Duane Harber, I am a modern, clever, handsome, fair, agreeable, inexpensive, beautiful person who loves writing and wants to share my knowledge and understanding with you.