Juneikerc.com

How to Uninstall npm Packages

Featured image for the post: How to Uninstall npm Packages

Many times, we keep installed packages that we don't use, whether in a project or globally. In this tutorial, you will learn how to uninstall npm packages effectively.

Uninstalling Dependencies with npm uninstall

To remove npm packages that have been installed using the npm install command, you simply need to navigate to the root of your project and execute the following command.

bash
npm uninstall <name-package>

Removing npm Development Dependencies

If the installed package was added as a development dependency using the -D flag, it would be removed as follows:

bash
npm uninstall -D <name-package>

Removing Global npm Packages

If the package was installed globally, you should use the -g flag, and in this case, you can do it from any file.

bash
npm uninstall -g <name-package>
Juneiker Castillo freelance web developer

I am Juneiker Castillo, a passionate front-end web developer deeply in love with programming and creating fast, scalable, and modern websites—a JavaScript enthusiast and a React.js lover ⚛️.

About me