This warning occurs when npm detects that cached tarball data is outdated or corrupted, typically due to network issues, cache corruption, or mismatched checksums. While npm usually recovers automatically, persistent warnings indicate stale cache data that should be refreshed or cleared.
Fixes npm WARN tarball tarball data for package seems to be stale. Refreshing cache.
npm cache verifynpm cache verifynpm WARN tarball tarball data for package seems to be stale. Refreshing cache.
npm caches downloaded packages to speed up subsequent installations. When npm detects that a cached tarball's data is stale (outdated or potentially corrupted), it issues this warning and attempts to refresh the cache by re-downloading the package metadata. This can happen due to interrupted downloads, corrupted cache entries, network failures, or version mismatches between npm versions.
Run npm cache verify to check and repair your cache. This is npm 5+ recommended approach:
npm cache verifyThis command validates cache entries and removes any corrupted data automatically without requiring a full cache wipe.
Force npm to revalidate all cached data by adding the --prefer-online flag:
npm install --prefer-onlineThis bypasses staleness checks and fetches fresh metadata from the registry.
Delete your lock file and node_modules directory, then reinstall:
rm -rf node_modules package-lock.json
npm installThis ensures npm creates a fresh lock file with current registry data.
If the above steps don't work, force clear the entire cache:
npm cache clean --force
npm installWARNING: This is destructive and npm will re-download all packages.
npm 5+ includes intelligent cache self-healing: corrupted cache entries are automatically detected on extraction and treated as missing, triggering a fresh download. The cache-lock-stale config setting (milliseconds) controls when cache lock files are considered stale. Use npm config set cache-lock-stale <milliseconds> to adjust. For debugging, use npm install --cache /tmp/empty-cache to isolate cache issues.