diff --git a/lib/cache.js b/lib/cache.js index 3a4681b2af107..dc3a6de727846 100644 --- a/lib/cache.js +++ b/lib/cache.js @@ -56,14 +56,20 @@ const clean = async (args) => { } const cachePath = path.join(npm.cache, '_cacache') if (!npm.flatOptions.force) { - throw new Error('As of npm@5, the npm cache self-heals from corruption ' + - 'issues and data extracted from the cache is guaranteed to be valid. ' + - 'If you want to make sure everything is consistent, use `npm cache ' + - 'verify` instead. On the other hand, if you\'re debugging an issue ' + - 'with the installer, you can use `npm install --cache /tmp/empty-cache` ' + - 'to use a temporary cache instead of nuking the actual one.\n\n' + - 'If you\'re sure you want to delete the entire cache, rerun this ' + - 'command with --force.') + throw new Error(`As of npm@5, the npm cache self-heals from corruption issues +by treating integrity mismatches as cache misses. As a result, +data extracted from the cache is guaranteed to be valid. If you +want to make sure everything is consistent, use \`npm cache verify\` +instead. Deleting the cache can only make npm go slower, and is +not likely to correct any problems you may be encountering! + +On the other hand, if you're debugging an issue with the installer, +or race conditions that depend on the timing of writing to an empty +cache, you can use \`npm install --cache /tmp/empty-cache\` to use a +temporary cache instead of nuking the actual one. + +If you're sure you want to delete the entire cache, rerun this command +with --force.`) } return rimraf(cachePath) }