As of npm@5, the npm cache has the ability to fix corruption issues by treating integrity mismatches as cache misses. This means that any data extracted from the cache will be guaranteed to be valid. If you want to ensure that everything is consistent, you can use the 'npm cache verify' command.

Deleting the cache is not recommended as it can actually slow down npm and is unlikely to solve any problems you may be facing.

However, if you are debugging an issue with the installer or race conditions that depend on the timing of writing to an empty cache, you can use the 'npm install --cache /tmp/empty-cache' command to use a temporary cache instead of deleting the actual one.

If you are certain that you want to delete the entire cache, you can rerun the command with the '--force' flag.

NPM Cache Self-Healing and Verification: Best Practices for npm@5+

原文地址: https://www.cveoy.top/t/topic/lM5c 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录