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.
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.
npm ERR! code E401 npm ERR! 401 Unauthorized - Token has expired
Token has expired - npm authentication failure
npm ERR! code ENOAUDIT npm ERR! Audit endpoint not supported
How to fix "npm ERR! code ENOAUDIT - Audit endpoint not supported"
npm ERR! code EBADDEVENGINES npm ERR! devEngines.runtime incompatible with current node version
How to fix "npm ERR! code EBADDEVENGINES - devEngines.runtime incompatible with current node version"
npm ERR! code EAI_NODATA npm ERR! errno EAI_NODATA npm ERR! getaddrinfo EAI_NODATA registry.npmjs.org
How to fix "npm ERR! code EAI_NODATA - getaddrinfo EAI_NODATA"
npm ERR! code ETOOMANYARGS npm ERR! Too many arguments
How to fix "npm ERR! code ETOOMANYARGS - Too many arguments"