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

More NPM tasks

Back to the full NPM Package Manager cheat sheet