Skip to content

Try our new Crash Courses!

Become a member using the button below to hide this banner and gain access to our new Crash Courses.

Uninstall a local package – npm

Summary

To uninstall a local package, enter the following command in your terminal:

npm uninstall package-name

To uninstall a local package that was installed as a devDependency, enter the following command in your terminal:

npm uninstall package-name --save-dev

Details

Uninstall dependency

To uninstall a regular dependency, you can use the npm uninstall command. For example, if you had the clipboard package installed in your project, you would enter the following command in your terminal to uninstall it:

npm uninstall clipboard

This will remove the package from the “dependencies” section of your package.json file and remove it from your node_modules folder.

Uninstall devDependency

To uninstall a devDependency, you can use the npm uninstall command with a --save-dev flag. For example, if you had installed browser-sync as a devDependency in your project, you would enter the following command in your terminal to uninstall it:

npm uninstall browser-sync --save-dev

This will remove the package from the “devDependencies” section of your package.json file and remove it from your node_modules folder.

Exercises

Run the following command to uninstall browser-sync from your project folder:

npm uninstall browser-sync --save-dev

Reference

Uninstalling packages and dependencies | npm Documentation

Back to: npm Reference > npm Local Packages