Home

How to Fix "Integrity check failed ..." Yarn Error

What to do when running into integrity check errors with Yarn.

Seeing an error like this?

error https://registry.yarnpkg.com/...:
Integrity check failed for "..."
(computed integrity doesn't match our records, got "sha512-... sha1-...")

Yarn suggests clearing the cache, which you can do with:

$ yarn cache clean

That didn't work for me because the integrity checksum was stored in the yarn.lock file. One option is to delete that file and regenerate it by running:

$ yarn install

That didn't work for me either, and it's not a great practice. In that case you're potentially updating all packages when really you just have a single issue with a single package.

Instead, I ran the following command:

$ yarn --update-checksums

This updated all the integrity checksums and then I was able to install the remainder of the packages and get the project working.


References:

Let's Connect

Keep Reading

2 Ways to Keep JavaScript Local

It's far too easy to let your JS code pollute the global namespace. Here are two methods for keeping your code local.

May 21, 2018

How To Delete a Git Tag

It's easy to delete a git tag from your local and remote repositories.

Dec 07, 2014

Custom XML Sitemap from a Catch All Route in Next.js

Building an XML sitemap in Next.js is a bit of an odd process. Here’s how I’ve done it by leveraging getStaticPaths methods from page components.

Aug 02, 2022