How to Uninstall Npm Packages

Originally published at https://coderrocketfuel.com

Uninstall Local Packages

To uninstall a package that was installed locally (using npm install <package> and stored in the node_modules directory), use this command:

$ npm uninstall <package>

After that command is run, the package will no longer be in your node_modules folder.

To also remove the package from the dependencies list in your package.json file, you can use either the -S or --save flag:

$ npm uninstall <package> --save
$ npm uninstall -S <package>

If the package is a devDependency, you can remove it from the package.json file with the -D or --save-dev flags:

$ npm uninstall <package> --save-dev
$ npm uninstall -D <package>

Uninstall Global Packages

Last, you can remove any npm package you've installed globally with the -g flag:

$ npm uninstall -g <package>

The global uninstall command will work from wherever you call it on your machine.

Thanks for reading

If you liked this post, share it with all of your programming buddies!

Follow us on Facebook | Twitter

Further reading

The Complete Node.js Developer Course (3rd Edition)

Angular & NodeJS - The MEAN Stack Guide

NodeJS - The Complete Guide (incl. MVC, REST APIs, GraphQL)

A Beginner’s Guide to npm — the Node Package Manager

Node Package Manager (NPM) Tutorial

Creating your first npm package

npm and the Future of JavaScript

Best JavaScript Frameworks, Libraries and Tools to Use in 2019

#npm #node-js

How to Uninstall Npm Packages
109.05 GEEK