Trying to figure out how to uninstall a local or global NPM package?
In this article, we'll cover how to uninstall both local and globabl NPM packages during the development process.
Let's get started!
Table Of Contents
Uninstall Local Packages
To uninstall a package that was installed locally (using
npm install <package> and stored in the
node_modules directory for a specific project), use this command:
npm uninstall <package>
After that command is run, the package will no longer be in your
To also remove the package from the
dependencies list in your
package.json file, you can add either the
--save flag to the command:
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
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
npm uninstall -g <package>
The global uninstall command will work from wherever you call it on your machine.
There you have it! As always, thanks for reading and happy coding!