Incorrect integrity when fetching from the cache

烂漫一生 提交于 2019-12-03 06:28:17

问题


When running yarn add --dev jest, I got error Incorrect integrity when fetching from the cache.

Full output:

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.

I tried removed node_modules, re-ran yarn install and yarn add --dev jest to no avail.

How do I fix this?


回答1:


yarn cache clean

To fix this, run:

yarn cache clean
yarn add --dev jest

From the yarn cache documentation:

yarn cache clean [<module_name...>]

Running this command will clear the global cache. It will be populated again the next time yarn or yarn install is run. Additionally, you can specify one or more packages that you want to clean.

You can also see where the cache is with yarn cache dir.

yarn cache dir

Running yarn cache dir will print out the path where yarn’s global cache is currently stored.




回答2:


Yarn cache clean did not help. We must downgrading yarn version on the server.

It turns out that the problem is associated with the use of private packages.

GitHub Yarnpkg - "Incorrect integrity when fetching from the cache" #7584




回答3:


For anyone who is working with heroku and sees this error:

  • install heroku cli
  • login via heroku login
  • heroku plugins:install heroku-repo
  • heroku repo:purge_cache -a $YOURAPPNAME

then do a manual rebuild



来源:https://stackoverflow.com/questions/58172688/incorrect-integrity-when-fetching-from-the-cache

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!