Uninstalling npm packages with `npm uninstall`
How to uninstall an npm Node package, locally or globally
To uninstall a package you have previously installed locally (using npm install <package-name>
in the node_modules
folder, run
npm uninstall <package-name>
from the project root folder (the folder that contains the node_modules folder).
This operation will also remove the reference in the package.json
file.
If the package was a development dependency, listed in the devDependencies of the package.json
file, you must use the -D
/ --save-dev
flag to remove it from the file:
npm uninstall -D <package-name>
If the package is installed globally, you need to add the -g
/ --global
flag:
npm uninstall -g <package-name>
for example:
npm uninstall -g webpack
and you can run this command from anywhere you want on your system because the folder where you currently are does not matter.
I wrote 21 books to help you become a better developer:
- HTML Handbook
- Next.js Pages Router Handbook
- Alpine.js Handbook
- HTMX Handbook
- TypeScript Handbook
- React Handbook
- SQL Handbook
- Git Cheat Sheet
- Laravel Handbook
- Express Handbook
- Swift Handbook
- Go Handbook
- PHP Handbook
- Python Handbook
- Linux Commands Handbook
- C Handbook
- JavaScript Handbook
- Svelte Handbook
- CSS Handbook
- Node.js Handbook
- Vue Handbook
Also, JOIN MY CODING BOOTCAMP, an amazing cohort course that will be a huge step up in your coding career - covering React, Next.js - next edition February 2025