How to Uninstall NPM Packages from a Node.js Project

Removing a dependency from a project is a 2-step process. First, you must delete the dependency from your node_modules/ folder, and second, remove its listing from your package.json. This ensures the package is fully removed. Instead of performing this task manually, we can use the npm uninstall command.

In this tutorial we'll:

  • Use npm uninstall to remove dependencies from a project
  • Learn how to uninstall global packages
  • Use npm prune to remove any untracked modules from the node_modules/ directory

By the end of this tutorial, you'll be able to remove unused or unneeded dependencies from your project.

Log in or Sign up to view the complete tutorial.

Sign in with your Osio Labs account
to gain instant access to our entire library.