Removing Multiple Packages

You can uninstall multiple packages simultaneously by providing their names separated by spaces:

npm uninstall package1 package2 package3

Remove NPM Package

NPM, which stands for Node Package Manager, is the default package manager of Node.js. Developed by Isaac Z. Schlueter, NPM is written in JavaScript and was initially released on the 12th of January, 2010.

Removing npm packages is a common task in Node.js development, whether you’re cleaning up dependencies, troubleshooting issues, or streamlining your project’s footprint. In this guide, we’ll walk through the various methods to uninstall npm packages from your project.

Table of Content

  • Removing Package using npm
  • Removing Packages from package.json
  • Removing Multiple Packages
  • Removing Globally Installed Packages
  • Uninstall Specific Version Package
  • Uninstalling all Unused Packages
  • Conclusion

Similar Reads

Removing Package using npm

To remove a package using the npm package manager, we can employ the command npm uninstall. The command npm uninstall is used to uninstall a package whether it is local or global....

Removing Packages from package.json

When you uninstall a package using npm uninstall, npm automatically removes the package from your package.json file’s dependencies or devDependencies section. If you want to remove a package from your project’s dependencies without uninstalling it, you can use the –save or –save-dev flag:...

Removing Multiple Packages

You can uninstall multiple packages simultaneously by providing their names separated by spaces:...

Removing Globally Installed Packages

The npm uninstall command can also be used to remove a package from the global environment. The -g option allows this to take place. In the following command we remove the mongoose package from the global environment:...

Uninstall Specific Version Package

The npm uninstall command can be used to remove only a specific version of a package. The following command uninstalls the version 4.18 of express package. The number after the @ symbol specifies the version....

Uninstalling all Unused Packages

The npm package manager provides the command npm prune which can be used to all the unused packages. We can use the npm prune command as follows:...

Conclusion

Uninstalling npm packages is a straightforward process using the npm CLI. Whether you’re removing individual packages, cleaning up unused dependencies, or managing global installations, npm provides flexible options to streamline your Node.js projects. By regularly reviewing and removing unnecessary packages, you can keep your projects lean and maintainable....

Contact Us