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