yarn报错:error Incorrect integrity when fetching from the cache

时间:2023-01-05 17:54:15

使用yarn添加jest:

yarn add --dev jest

执行上面的命令时,报错:

lula (master)$ yarn add --dev jest
yarn add v1.19.0
info No lockfile found.
[1/4] Resolving packages...
warning jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > left-pad@1.3.0: use String.prototype.padStart()
[2/4] Fetching packages...
error Incorrect integrity when fetching from the cache
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

解决方案:

google一下,找到了解决方案,即执行yarn cache clean在继续安装。命令如下:

yarn cache clean
yarn add --dev jest

如果还是解决不了,可以删除~/.cache/yarn里的缓存,在重试