'Heroku Build Failing Due To Code Integrity
I have an application deployed on Heroku and I have not had problems redeploying it, up until yesterday.
I had to upgrade one of the dependencies in my package-lock.json/yarn.lock files and when trying to upload it to Heroku, I get the following:
Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote: NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 10.15.x
remote: engines.npm (package.json): 6.14.x
remote:
remote: Resolving node version 10.15.x...
remote: Downloading and installing node 10.15.3...
remote: Bootstrapping npm 6.14.x (replacing 6.4.1)...
remote: npm 6.14.x installed
remote:
remote: -----> Installing dependencies
remote: Installing node modules (package.json + package-lock)
remote: npm ERR! code EINTEGRITY
remote: npm ERR! sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= integrity checksum failed when using sha1: wanted sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= but got sha512-rIqbOrKb8GJmx/5bc2M0QchhUouMXSpd1RTclXsB41JdL+VtnojfaJR+h7F9k18/4kHUsBFgk80Uk+q569vjPA== sha1-sAoAIwoRCMSMFp5popGq/aOqzWM=. (7897 bytes)
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.P3BnU/_logs/2020-03-18T06_17_36_985Z-debug.log
remote:
remote: -----> Build failed
remote:
remote: We're sorry this build is failing! You can troubleshoot common issues here:
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote: If you're stuck, please submit a ticket so we can help:
remote: https://help.heroku.com/
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
I realize the problem resides within this line:
npm ERR! code EINTEGRITY remote: npm ERR! sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= integrity checksum failed when using sha1: wanted sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= but got sha512-rIqbOrKb8GJmx/5bc2M0QchhUouMXSpd1RTclXsB41JdL+VtnojfaJR+h7F9k18/4kHUsBFgk80Uk+q569vjPA== sha1-sAoAIwoRCMSMFp5popGq/aOqzWM=. (7897 bytes)
but I do not know why it is occurring now or what triggered it (as it did not happen before).
I have tried searching online and clearing the cache, reading Heroku's Node.js Troubleshooting, adding an engines key to my package.json file to specify node/npm versions, but nothing works.
I have NOT upgraded Node/NPM in my development environment, so those versions are the same.
Solution 1:[1]
Per @TinNguyen's comment, I executed the following commands:
npm uninstall package_name
and then :
npm install package_name
and that seemed to fix the issue.
Solution 2:[2]
I simply deleted package-lock.json and npm modules, then run npm install.
Solution 3:[3]
I had the same issue and fixed it. Probably you have npm vulnerabilities and if you cant fix them all try upgrading all you packages in package.json useful tool is
npm install -g npm-check-updates
then
ncu --upgrade
then
npm install
make sure to delete package-lock.json before npm install
Solution 4:[4]
Simply: delete package-lock.json and run npm install
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | tomerpacific |
| Solution 2 | Stones |
| Solution 3 | Ahmed Younes |
| Solution 4 | Estifanos Neway |
