0

I connected my github repo with heroku so I can have deployments from there automatically. I created a react app and I have some dependecies that requires " npm install --legacy-peer-deps ", and when heroku is building the app, of course it doesn't use that command. How can I overwrite "npm install" with "npm install --legacy-peer-deps " ? I tried to put in the package.json at scripts where is build insted of "react-scripts build ", I've put " react-scripts build && npm install --legacy-peer-deps" but it didn't work.

This is what it says in the error:

  npm ERR! Fix the upstream dependency conflict, or retry
       npm ERR! this command with --force, or --legacy-peer-deps
       npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Thank you in advance

Konrad
  • 21,590
  • 4
  • 28
  • 64

1 Answers1

0

I changed in package.json the version of npm to 6.14.9 and it worked and I also kept the npm install --legacy-peer-deps && react-scripts build

     "engines": {
    "node": "16.13.2",
    "npm": "6.14.9"
},