首页 > 解决方案 > 从缓存中获取时完整性不正确

问题描述

运行时yarn add --dev jest从缓存中获取时出现错误完整性错误

完整输出:

tests (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.

我尝试删除node_modules,重新运行yarn installyarn add --dev jest但无济于事。

我该如何解决?

标签: yarnpkg

解决方案


yarn cache clean

要解决此问题,请运行:

yarn cache clean
yarn add --dev jest

来自纱线缓存文档

yarn cache clean [<module_name...>]

运行此命令将清除全局缓存。下次运行 yarn 或 yarn install 时,它将再次填充。此外,您可以指定一个或多个要清理的包。

您还可以查看缓存的位置yarn cache dir

yarn cache dir

运行 yarn cache dir 会打印出 yarn 的全局缓存当前存放的路径。


推荐阅读