Home > other >  Updating my ReactJS website on Heroku failed
Updating my ReactJS website on Heroku failed

Time:03-27

I wanted to make changes to my React.JS website hosted on heroku, I followed the following steps to edit my website:

run git add . run git commit -m "make it better" and lastly run git push origin main

After getting the error, I run npm cache clean --force & npm i --force but to no avail

then I kept getting the following error:

remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/nodejs
remote: -----> Node.js app detected
remote:        
remote: -----> Creating runtime environment
remote:
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NODE_VERBOSE=false
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote:        engines.node (package.json):  unspecified
remote:        engines.npm (package.json):   unspecified (use default)
remote:
remote:        Resolving node version 16.x...
remote:        Downloading and installing node 16.14.2...
remote:        Using default npm version: 8.5.0
remote:        
remote: -----> Restoring cache
remote:        Cached directories were not restored due to a change in version of node, npm, yarn or stack
remote:        Module installation may take longer for this build
remote:        
remote: -----> Installing dependencies
remote:        Installing node modules (package.json)
remote:        npm ERR! code ERESOLVE
remote:        npm ERR! ERESOLVE unable to resolve dependency tree
remote:        npm ERR!
remote:        npm ERR! While resolving: [email protected]
remote:        npm ERR! Found: @emotion/[email protected]
remote:        npm ERR! node_modules/@emotion/styled
remote:        npm ERR!   @emotion/styled@"^11.8.1" from the root project
remote:        npm ERR!
remote:        npm ERR! Could not resolve dependency:
remote:        npm ERR! peer @emotion/styled@"^10.0.27" from @material-ui/[email protected]
remote:        npm ERR! node_modules/@material-ui/styled-engine
remote:        npm ERR!   @material-ui/styled-engine@"^5.0.0-alpha.11" from the root project
remote:        npm ERR!
remote:        npm ERR! Fix the upstream dependency conflict, or retry
remote:        npm ERR! this command with --force, or --legacy-peer-deps
remote:        npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
remote:        npm ERR!
remote:        npm ERR! See /tmp/npmcache.rdttK/eresolve-report.txt for a full report.
remote:
remote:        npm ERR! A complete log of this run can be found in:
remote:        npm ERR!     /tmp/npmcache.rdttK/_logs/2022-03-21T08_48_10_190Z-debug-0.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:        Some possible problems:
remote:
remote:        - Node version not specified in package.json
remote:          https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version

and after editing, I wanted to push my changes to main branch.

CodePudding user response:

I am guessing you were using an older version of node.js when you built your app, if so try to add the following line in your package.json file:

"engines":
 {
    "node": "14.16.1", 
     "npm": "6.14.12"
 }
  • Related