cacheport

Error · npm

Fixing npm ERR! code EINTEGRITY

npm downloaded a tarball and its hash did not match the integrity value recorded in package-lock.json. npm refuses to install it, which is exactly what should happen when bytes differ.

What you see

build log
npm ERR! code EINTEGRITY
npm ERR! sha512-... integrity checksum failed when using sha512: wanted sha512-AAAA... but got sha512-BBBB...

Common causes

  • A corrupted entry in the local npm cache, often from an interrupted download.
  • A proxy or mirror that rewrote or re-packed the tarball.
  • A lockfile edited by hand or merged badly, with an integrity value from a different version.
  • Very rarely, a tarball that really changed upstream.

How to fix it

  1. 01

    Verify the local cache

    npm can check and repair its cache. This fixes the most common cause.

    shell
    npm cache verify
    npm ci
  2. 02

    Check the lockfile entry

    Compare the integrity value in package-lock.json with the one the registry publishes.

    shell
    npm view react@19.1.0 dist.integrity
  3. 03

    Do not delete the lockfile to make it go away

    Regenerating the lockfile accepts whatever bytes the network delivers today. Find which package fails first.

    shell
    npm ci --loglevel verbose 2>&1 | grep -i integrity

Other network failures in builds

Start on the free plan

20 GB of cache, every registry, unlimited users. Upgrade when your pipelines outgrow it.