Expert in

PC Health Solution

Free Download
IObit > Knowbase > Troubleshoot

How to Uninstall NPM Package (Local & Global) & Fix Common Errors

Need to uninstall NPM package safely? Learn how to uninstall NPM package locally and globally, fix NPM uninstall not working issues step by step.

Highlights

Understand That NPM Packages Can be Local or Global

How to Uninstall Local NPM Package in Project Folder 

How to Uninstall NPM Global Package

Troubleshoot NPM Uninstall Not Working Issues 

Before You Uninstall an NPM Package Windows What You Should Do

Use Clean up Software to Scan for Residual Files

If you need to uninstall NPM package dependencies from a project or remove a CLI tool from your system, the process is usually simple - but it can get confusing when local and global installs are mixed up. Follow this guide to learn how to remove local and global packages step by step.

Before removing anything, you need to distinguish NPM packages. Knowing this difference is the key to avoiding uninstall mistakes.

There are two main types of NPM installations:

  • Local packages: Installed inside a specific project folder.

  • Global packages: Installed system-wide for command-line use.

When you uninstall NPM package, the exact command depends on how the package was originally installed. If you remove a local package, NPM typically updates your project files automatically. If it’s global, you’ll need to use the global flag.

Step 1. Open your terminal

  • For Windows: Press Win + R, type cmd and press Enter.

  • For macOS: Press Command + Space, type Terminal, and open it.

  • For Linux: Press Ctrl + Alt + T (on most distributions).

Step 2. Navigate to your project folder

Use the cd (change directory) command to go to the folder that contains your package.json file. For example:

bash

cd C:\my-project

If you're unsure where you are, type pwd (macOS/Linux) or cd with no arguments (Windows) to see the current path.

Step 3. Run the uninstall command

Inside the same terminal window, type:

bash

npm uninstall package-name

For example:

bash

npm uninstall lodash

Then press Enter.

NPM will delete the lodash folder from node modules folder. It will also automatically remove lodash from package.json and package-lock.json.

IObit Uninstaller

Free Download

If the package was installed globally, use the -g flag:

bash

npm uninstall -g package-name

Example:

bash

npm uninstall -g typescript

You can run this from any directory – you don’t need to be inside a project folder.

  • Typo in package name – Check the exact spelling in package.json dependencies.

  • Package is a dependency of another package – NPM protects transitive dependencies. Use NPM uninstall --depth=0 or manually remove the parent package first.

  • Lock file corruption – Delete node_modules and package-lock.json, then run NPM install to rebuild a clean state.

  • NPM cache issues – Run NPM cache clean --force and retry the uninstall.

If all else fails, manually delete the package folder from node_modules and remove its entry from package.json and package-lock.json. Then run NPM install to resync everything.

To avoid dependency issues, keep these quick tips in mind:

  • Confirm whether the package is local or global

  • Make sure you’re in the correct project directory

  • Check if other packages still depend on it

  • Review package.json after removal

  • Reinstall dependencies if your project starts failing afterward

These small checks can save you time, especially in shared or older projects.

While uninstall NPM packages commands work perfectly for Node.js packages, you might occasionally run into stubborn Windows applications that refuse to uninstall cleanly — leaving behind leftover files, empty folders, or registry entries. That’s where a dedicated tool like IObit Uninstaller can be a helpful companion. 

It forcefully removes programs, scans for leftovers, and even batch uninstalls multiple apps at once. So if you ever switch from managing JavaScript dependencies to cleaning up your system in general, give IObit Uninstaller a try. For NPM packages though, stick with the trusty command line — but it’s good to have options.

IObit Uninstaller

Free Download


IObit uses cookies to improve content and ensure you get the best experience on our website.
Continue to browse our website agreeing to our privacy policy.

I Accept