Cache & Performance in NPM
From the NPM Package Manager cheat sheet ยท Workspaces & Advanced ยท verified Jul 2026
Cache & Performance
Manage NPM cache and improve performance
bash
# View cache info
npm cache ls
npm cache verify
# Clean cache
npm cache clean --force
# Offline install
npm install --offline
# Prefer offline
npm install --prefer-offline
# Cache location
npm config get cache
# Set cache folder
npm config set cache /path/to/cache๐ก Cache speeds up repeated installs
โก npm ci is much faster for CI/CD
๐ --prefer-offline uses cache when possible
๐ข Essential for CI/CD optimization
๐ Related: yarn, pnpm for faster installs
cacheperformance