Search code examples
node.jsreactjsherokunpm

Error while deploying node project on heroku


I deployed the project successfully and then I made some changes in package.json and in other files.

Now it is giving error.

In package.json file


    "test": "echo \"Error: no test specified\" && exit 1",

    "start": "node server.js",

    "heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"

  },

Getting the following error

remote: -----> Build
remote:        Running heroku-postbuild
remote:        
remote:        > [email protected] heroku-postbuild
remote:        > NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
remote:
remote:        
remote:        up to date, audited 1973 packages in 4s
remote:
remote:        162 packages are looking for funding
remote:          run `npm fund` for details
remote:
remote:        27 vulnerabilities (16 moderate, 9 high, 2 critical)
remote:
remote:        To address all issues (including breaking changes), run:
remote:          npm audit fix --force
remote:
remote:        Run `npm audit` for details.
remote:        
remote:        > [email protected] build
remote:        > react-scripts build
remote:
remote:   sh: 1: react-scripts: Permission denied
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: 

It seems that 'npm run build' is giving error.


Solution

  • You can try to force push your changes using git push -f heroku master. You can read more here.