Heroku Nodejs - React error deploying app

Viewed 1614

Hi everyone I'm trying to deploy a React-node App on Heroku and this is the console log of heroku:

-----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       
-----> Installing binaries
       engines.node (package.json):  unspecified
       engines.npm (package.json):   unspecified (use default)
       
       Resolving node version 14.x...
       Downloading and installing node 14.17.1...
       Using default npm version: 6.14.13
       
-----> Installing dependencies
       Installing node modules
       npm ERR! bindings not accessible from watchpack-chokidar2:fsevents
       
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /tmp/npmcache.5mYJI/_logs/2021-06-23T22_19_01_465Z-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:
       
       - Node version not specified in package.json
         https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
       
       Love,
       Heroku
       
 !     Push rejected, failed to compile Node.js app.
 !     Push failed

And this is my repositorie: https://github.com/aadiegoaa96/reactporfolioDiego And the Heroku app link: https://reactporfoliodnbc.herokuapp.com/

Thanks for all the support.

3 Answers

I had similar issue. Deleting package-lock.json file solved the issue.

I have solved this issue when i figured out that my local npm version wasn't fit with the npm version in Heroku. I needed to add the same npm version in my Heroku environment as my local version like this in package.json:

{
"engines":{
"node":"yournodeversion",
"npm":"yournpmversion"
}
}
Related