Heroku Nodejs - React error deploying app

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.

Upvotes: 2

Views: 1878

Answers (3)

Muhammad Zeeshan
Muhammad Zeeshan

Reputation: 126

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

Upvotes: 5

arielb
arielb

Reputation: 390

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"
}
}

Upvotes: 1

Jagan Kaartik
Jagan Kaartik

Reputation: 590

Using the create-react-app buildpack for Heroku can solve this issue.

Currently, your react-app is treated as a regular node.js application as the node.js buildpack is used which is automatically inferred due to the presence of package.json in the root.

CRA Buildpack : https://elements.heroku.com/buildpacks/nhutphuongit/create-react-app-buildpack

(Similar Q) - React Application on Heroku

Upvotes: 0

Related Questions