What is NPM uninstall? How to use this command to remove packages? This post from MiniTool Partition Wizard shows you all. It tells you how to delete a local package, a global package, and a dev dependency.

Introduction to NPM Uninstall

Npm, short for Node Package Manager, is the default package manager for Node.js, which is used to build scalable network applications.

With the npm install command, you can download and install third-party packages and command-line programs written by others from the NPM server for local use. With the npm uninstall command, you can remove a package and its dependencies installed.

There are many ways of removing a package from the project’s root directory. However, these ways just delete the package from the node modules and the dependencies are left. In addition, you can’t delete these dependency files one by one because you don’t know their names. These files will occupy space. Therefore, in some cases, the npm uninstall command is recommended.

How to Install NPM and Node.js on Windows & Mac & Ubuntu
How to Install NPM and Node.js on Windows & Mac & Ubuntu

This post offers you a brief introduction to NPM and Node.js. It also shows you how to download and install them on Windows, macOS, and Ubuntu.

Read More

How to Use NPM Uninstall

There are 3 npm remove package methods.

#1. Uninstall NPM Packages Locally

You can use the npm install package-name command to install a package into a project’s root directory.

Then, you can also use the npm uninstall package-name command to uninstall a package from a project’s root directory. This command will detect and remove that package from the project’s node-modules directory, package.json, npm-shrinkwrap.json, or package-lock.json file. The package will become unusable.

After the uninstallation, you can check whether the uninstallation is successful by searching for that file’s name within the package.json, npm-shrinkwrap.json, or package-lock.json file under dependencies.

5 Ways to Fix the Npm Install Not Working Issue
5 Ways to Fix the Npm Install Not Working Issue

When you run the npm install command, you may receive the npm command not found, npm err code 1, or other errors. This post shows you solutions.

Read More

#2. Uninstall NPM Package Globally

What’s the difference between a local package and a global package? The difference is as follows:

A local package will be installed into the node_modules folder of a specified project while a global package will be installed into the node_modules folder under the Node installation directory, generally in the \Users\username\AppData\Roaming\ directory. A local package can only be accessed within that project and not in any other project.

How to install a global package? You need to use the npm install -g package-name command. Unlike local packages, global packages are not added as a dependency in the package.json file. You need to run the npm list -g command to check and confirm that you have that package installed globally.

Then, you can use the npm uninstall -g package-name command to uninstall that global package.

#3. Uninstall Dev Dependencies

A dev dependency is a package that a developer needs during development. You can use the npm uninstall -D package-name command or the npm uninstall -save-dev package-name command to uninstall a dev dependency. Note that you must run this command in the directory (folder) where the dependencies are located.

A Simple Way to Fix NPM ERR Missing Script Start
A Simple Way to Fix NPM ERR Missing Script Start

This post offers a simple way to fix the npm ERR missing script start error that occurs when you run the npm start command.

Read More

Bottom Line

Do you have other ideas about the npm uninstall command? Share them with us in the following comment zone. In addition, MiniTool Partition Wizard can help you clone the system, manage disks better, and recover data. If you have this need, you can download it from the official website.

  • linkedin
  • reddit