Fixing npm EINTEGRITY Errors in npm install and npm ci
When npm install or npm ci stops with npm error code EINTEGRITY, the hash recorded in package-lock.json (integrity) does not match the hash of the package you actually downloaded. Look up the registry's value with npm view <package>@<version> dist.integrity. If the value in package-lock.json is the one that differs, reinstall that package with npm install or restore package-lock.json from Git, and the error goes away.
The same approach works when npm install or npm ci fails only in CI (GitHub Actions, for example) or on another PC, while it passes locally. I reproduced this error in a test environment and confirmed the full message, and confirmed that the fixes below make it go away.
The test environment was Ubuntu 24.04. I mainly used Node.js 22.23.4 (npm 10.9.9), and for comparison I also tried Node.js 24.22.1 (npm 11.19.1). The example package was is-number 7.0.0, and the registry was the default registry.npmjs.org. I caused the error by rewriting the integrity in package-lock.json, or by serving a modified tarball from a server inside the test environment. I did not test Windows or macOS, real CI services, real servers such as a private registry, or yarn and pnpm.
The full error message
I created a project with npm init -y, installed is-number with npm install is-number@7.0.0, and then changed only the integrity of is-number in package-lock.json to a different value. After deleting node_modules and running npm install, npm 10.9.9 stopped with the following output (exit code 1). I replaced the log file path with ~/.npm/_logs. I ran it with time to measure the duration, so the last three lines are its output.
$ time npm install
npm warn tarball tarball data for is-number@https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz (sha512-AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ==) seems to be corrupted. Trying again.
npm warn tarball tarball data for is-number@https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz (sha512-AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ==) seems to be corrupted. Trying again.
npm error code EINTEGRITY
npm error sha512-AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ== integrity checksum failed when using sha512: wanted sha512-AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ== but got sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==. (3730 bytes)
npm error A complete log of this run can be found in: ~/.npm/_logs/2026-11-14T01_43_36_687Z-debug-0.log
real 2m20.589s
user 0m0.402s
sys 0m0.040s
The first two warning lines mean "the tarball data seems corrupted, so I'll fetch it again." npm prints this warning once for each download that does not match. Both downloads failed to match, so the error on line 3 and after stopped the run. In the section below where I served the tarball from a server in the test environment, the server received two requests and npm printed two warnings. No node_modules was created.
npm ci printed the same message. npm 11.19.1 printed the same warning and error text.
In this test, npm install stopped after about 2 minutes 20 seconds, and npm ci stopped after about 1 minute 10 seconds. When I set fetch-retries (default 2) to 0 and ran the same npm install, it stopped after about 0.4 seconds.
What wanted and got refer to
The error message on line 4 is built by the ssri library (confirmed in the source bundled with npm 10.9.9). There are three parts to read:
| Part | Meaning |
|---|---|
wanted sha512-… |
The expected hash. In this example, it is the value written in the integrity of package-lock.json. |
but got sha512-… |
The hash computed from the data that was actually downloaded. |
(3730 bytes) |
The size of the downloaded data. |
The sha512-AQEB… at the beginning of the line is the same value as wanted. integrity is the field that records the hash of that package's tarball (package-lock.json documentation).
Checking the registry value to see which side is wrong
You can tell whether wanted or got is correct by comparing with the hash that the registry publishes. Use npm view with the version included to print dist.integrity.
$ npm view is-number@7.0.0 dist.integrity
sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==
In this example, the registry value matched got and did not match wanted. So the value recorded in package-lock.json was wrong. For this case, use one of the two fixes in the next section.
Conversely, wanted can match the registry value while only got differs. In that case, the downloaded data is wrong. The section "When the downloaded data is the one that's wrong" covers that case.
Fixing it when package-lock.json is wrong
Reinstall the package with an explicit version
Run npm install for the failing package with the version included.
$ npm install is-number@7.0.0
added 1 package, and audited 2 packages in 355ms
found 0 vulnerabilities
The integrity in package-lock.json was rewritten to match the registry value sha512-41Cif…. I compared it with cmp against a copy of package-lock.json I had saved before the change, and they were identical. Next, I deleted node_modules and ran npm ci. It finished without an error (exit code 0).
$ rm -rf node_modules && npm ci
added 1 package, and audited 2 packages in 320ms
found 0 vulnerabilities
Restoring package-lock.json with Git
If a correct package-lock.json is committed, restoring it from there is the most reliable option. In the test, I committed the correct state, changed integrity, and then restored the file with git checkout package-lock.json. The following npm ci finished without an error.
$ git checkout package-lock.json && git status --short
Updated 1 path from the index
?? node_modules/
npm cache clean –force does not fix it
I also tried clearing the npm cache. Running npm cache clean --force and then npm install stopped with the same EINTEGRITY error. The wrong value is in package-lock.json, so clearing the cache and downloading again does not change the hash of the data the registry sends.
The npm cache documentation also says that data going through the cache is verified both when it is stored and when it is read. If the data is corrupted, npm either raises an error or fetches it again automatically. It states that you do not need to clear the cache for any purpose other than freeing disk space.
I actually replaced the cached is-number tarball with a 6-byte string broken and then ran npm install. npm printed cached data … seems to be corrupted. Refreshing cache., and the install succeeded without an error. A corrupted cache alone did not produce EINTEGRITY.
When the downloaded data is the one that's wrong
In the test environment, I started a server that serves a slightly modified is-number tarball. I kept the integrity in package-lock.json correct and pointed only resolved (where the tarball is fetched from) at that server.
"resolved": "http://127.0.0.1:8080/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
I ran npm install with an empty cache. This time wanted matched the registry value, and got was a different value. (I replaced the log file path.)
$ rm -rf node_modules && npm install
npm warn tarball tarball data for is-number@http://127.0.0.1:8080/is-number-7.0.0.tgz (sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==) seems to be corrupted. Trying again.
npm warn tarball tarball data for is-number@http://127.0.0.1:8080/is-number-7.0.0.tgz (sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==) seems to be corrupted. Trying again.
npm error code EINTEGRITY
npm error sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== integrity checksum failed when using sha512: wanted sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== but got sha512-ylNTafYtykIZmBq0pRo3DkEYrYuE4VlvmkTzw9Zb6sD/aeqhvbh6gsktv9Yz+LbYzDnYMOD2PX2FB0ccKYPjgw==. (3794 bytes)
npm error A complete log of this run can be found in: ~/.npm/_logs/2026-11-14T01_47_13_943Z-debug-0.log
In this case, do not edit package-lock.json to make it match. Instead, check the URL shown after tarball data for is-number@ in the first warning line to see where the data is coming from. In the test, I restored package-lock.json with Git and ran npm ci with an empty cache. It finished without an error, and the installed is-number index.js had its original contents.
In an environment where the correct tarball is still in the cache, the same package-lock.json did not produce this error. After I changed resolved, npm install succeeded with the cache present, and the server recorded no requests. If a build passes locally but fails only in CI, the correct data may simply still be in your local cache.
Deleting the integrity line from package-lock.json also makes the error go away. In the test, when I deleted the line from the state that caused EINTEGRITY with a wrong integrity, npm install succeeded. However, running npm install or npm ci afterward did not bring the integrity line back. In that state, when I pointed resolved at a server that served a modified tarball, the install succeeded without an error, and the // changed line I had appended to the end of index.js was installed as is. Since you can no longer detect when the data differs, avoid this workaround.





