Removing Packages in NPM

From the NPM Package Manager cheat sheet ยท Package Management ยท verified Jul 2026

Removing Packages

Uninstall and clean up packages

bash
# Remove package
npm uninstall express
npm remove express  # Alias
npm rm express  # Short alias

# Remove dev dependency
npm uninstall -D nodemon

# Remove global package
npm uninstall -g typescript

# Remove without updating package.json
npm uninstall express --no-save

# Clean cache
npm cache clean --force
npm cache verify
๐Ÿ’ก npm prune removes packages not in package.json
๐Ÿ“Œ Cache clean might be needed for stubborn issues
โš ๏ธ Removing node_modules is the nuclear option
๐ŸŸข Essential - Keep project clean and lean
๐Ÿ”— Related: npx depcheck finds unused packages
uninstallcleanup

More NPM tasks

Back to the full NPM Package Manager cheat sheet