1

I am trying to deploy my app onto heroku, yet I receive a build erorr where it fails to install the dependencies using npm install. Is there anyway I can install with "legacy-peer-deps"?

Thank you so much...

I tried editing my procifile file with the following contents in it

web: npm install --legacy-peer-deps
web: npm start

2 Answers2

2

Ideally, you should resolve the underlying dependency issue so your application works without this option. But you should be able to configure it by setting environment variable ("config var" in Heroku-speak).

I believe the legacy-peer-deps setting will do the trick:

heroku config:set NPM_CONFIG_LEGACY_PEER_DEPS=true

Then you'll need to redeploy.

Alternatively, you could add an .npmrc file to your project:

legacy-peer-deps = true

Commit it, then redeploy.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
1

It is recommended to fix your dependency issues, but in case there's still the need to deploy it as is, the easiest way to do so would be the following:

  1. Go to your app account on Heroku.
  2. Go to settings.
  3. Click on 'Reveal Config Vars'.
  4. Add as key:

NPM_CONFIG_LEGACY_PEER_DEPS

  1. Add as value:

true

  1. Deploy

Good luck!

dani_l_n
  • 376
  • 1
  • 11