I will be using Nodemon to demonstrate how to remove a dev dependency. You must run the command in the directory (folder) where the dependency is located. The basic syntax for doing this is npm uninstall -D package-name or npm uninstall -save-dev package-name To remove a dev dependency, you need to attach the -D or -save-dev flag to the npm uninstall, and then specify the name of the package.
How to Remove a Dev Dependency with npm UninstallĪ dev dependency is a package used during development only. There’s even no dependency key anymore because there is no dependency. In the screenshot below, you can see that Express is listed as a dependency in the package.json file.īut after I run npm uninstall express, you won’t see Express listed as a dependency again: The package I will be using to demonstrate how a package is uninstalled is Express – a NodeJS framework. To remove a package with the npm uninstall command, you can use the syntax npm uninstall package-name in the directory where the package is located. How to Remove a Package with npm Uninstall In this article, I will show you how to uninstall a regular package, a global package, and a dev dependency. The way you uninstall a regular package or dependency is not the way you should uninstall a global package and a dev dependency, though. To uninstall a package, you can use the command provided by npm for the purpose – npm uninstall. The Node Package Manager (NPM) provides various commands that let you work with packages.Īnd just as you can install a package from the npm library, you can uninstall it.