unable to perform git push in heroku

Viewed 42

I am not able to push my files/repo to heroku it gives an error as follows

$ git push -f heroku main
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
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: -----> Build
remote:        Running heroku-postbuild        
remote:        > ecommerce@1.0.0 heroku-postbuild
remote:        > NPM_CONFIG_PRODUCTION=false && npm install --prefix frontend && npm run build --prefix frontend
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

And yes in my package.json folder I have mentioned the versions of node and npm in engine section

Please anyone help why I am not able to push in heroku

2 Answers

If you use yarn:

git rm yarn.lock

git push heroku master

If you use npm:

git rm package-lock.json

git push heroku master

git push heroku master

Setting Heroku stack. In this case to heroku-20
heroku stack:set heroku-20 then push

Related