bigcommerce / sample-app-nodejs

A reference implementation of a BigCommerce single-click app, in Node.JS + Next.js/React
MIT License
59 stars 340 forks source link

[Solved] Heroku build fails #88

Closed matt-bailey closed 2 years ago

matt-bailey commented 2 years ago

When I try to deploy the app I get the following error:

-----> Installing dependencies
       Installing node modules
       npm ERR! code EINTEGRITY
       npm ERR! sha512-oU39CH8fMpZw/QHAlfYgaceTM7kPHBbVPiJvKzSKtlkzYixAaB97UwReN1IKF+kdLL/tIOZDGKRZoJS5ZyAkNA== integrity checksum failed when using sha512: wanted sha512-oU39CH8fMpZw/QHAlfYgaceTM7kPHBbVPiJvKzSKtlkzYixAaB97UwReN1IKF+kdLL/tIOZDGKRZoJS5ZyAkNA== but got sha512-BtCkKT5/o5gGLHE78+zP84J0XhTYLNdhXEdFwwsDPKLeQ0P9dyjk3lc801oY3lj32see/nZdpfTkI8u4WyGPBw==. (11161 bytes)

       npm ERR! A complete log of this run can be found in:
       npm ERR!     /tmp/npmcache.5Jgej/_logs/2022-02-22T15_11_43_601Z-debug.log
-----> Build failed

       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys

       Some possible problems:

       - Dangerous semver range (>) in engines.node
         https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version

       Love,
       Heroku

 !     Push rejected, failed to compile Node.js app.
 !     Push failed
matt-bailey commented 2 years ago

I'm going to answer my own question, for anyone else struggling with this. Basically I missed a few things (or at least the documentation doesn't tell you to do this):

  1. Fork the repo - don't just click the 'Deploy to Heroku' button on this repo
  2. I don't know if this is required or not (the error above suggests there's an integrity issue with one of the dependencies), but I removed package-lock.json, and then ran npm install to generate a new one
  3. Make sure you then update the URL on the 'Deploy to Heroku' button to your own forked, updated repo, or you'll only end up trying to deploy the original repo again and getting the same error (this got me a few times)

Hope this helps...

Ben5874 commented 2 years ago

Thanks Matt, I copied your solution. Deleted the package-lock.json, ran npm install and then went into the readme and updated the Heroku deploy link to use the forked version. It worked.

bc-chaz commented 2 years ago

This issue has been addressed in https://github.com/bigcommerce/sample-app-nodejs/pull/102. Confirmed successful Heroku deploy from main branch