React-fontawesome: Don't support React 17?

Created on 29 Dec 2020  Â·  15Comments  Â·  Source: FortAwesome/react-fontawesome

npm ERR! dev react@"^17.0.1" from the root project
npm ERR! peer react@">=16.x" from @fortawesome/[email protected]
npm ERR! node_modules/@fortawesome/react-fontawesome
npm ERR! @fortawesome/react-fontawesome@"0.1.14" from the root project

Most helpful comment

Same here with npm 7.8.0. However, I used the flag --legacy-peer-deps to upgrade react to 17.0.2 regardless the error and it seems to work.

All 15 comments

@fikyair I can't reproduce this. What version of NPM are you using?

I have same issue with npm version 7.4.2.

Same issue with npm version 7.5.2.

npm install [email protected] [email protected]
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"17.0.1" from the root project
npm ERR! peer react@">=16.x" from @fortawesome/[email protected]
npm ERR! node_modules/@fortawesome/react-fontawesome
npm ERR! @fortawesome/react-fontawesome@"^0.1.14" from the root project
npm ERR! 33 more (@material-ui/core, @material-ui/icons, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^0.14.0 || ^15.0.0 || ^16.0.0" from [email protected]
npm ERR! node_modules/create-react-context
npm ERR! create-react-context@"^0.3.0" from [email protected]
npm ERR! node_modules/react-popper
npm ERR! react-popper@"^1.3.4" from [email protected]
npm ERR! node_modules/react-datepicker
npm ERR! react-datepicker@"^3.4.1" from the root project
npm ERR!
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.

Yep, also getting this error still. NPM version 7.5.4

peer react@">=16.x" from @fortawesome/[email protected]
npm ERR! node_modules/@fortawesome/react-fontawesome
npm ERR! @fortawesome/react-fontawesome@"^0.1.14" from the root project
npm ERR! 15 more (@next/react-dev-overlay, framer-motion, next, react-dom, ...)

Same on npm 7.6.3

same issue with npm 7.0.10, but no issue at all using yarn 1.22.10

Same here with npm 7.8.0. However, I used the flag --legacy-peer-deps to upgrade react to 17.0.2 regardless the error and it seems to work.

Try --force instead.

I had similar problem recently, and for some reason I was not able to normally install react-spring, not even with --legacy-peer-deps. Not sure if its fa problem tho.

Any change on this? Just bumped into this and unsure how to proceed

Any change on this? Just bumped into this and unsure how to proceed

Try installing with --force / legacy

Installing with --force or --legacy-peer-deps works, but that's not a reasonable solution for this problem.

EDIT: Did a little more digging, this stack overflow answer was helpful. Looks like the root of the issue is the difference between how npm@6 and npm@7 deals with missing peer dependencies, which is why the --use-legacy-deps works - it's saying to use npm@6's (legacy) behavior instead of the new behavior of npm@7 which is to throw errors and exit.

If you don't want to use --force or --use-legacy-deps you can try adding this to your package.json:

  "resolutions": {
    "**/react": "17.0.2",
    "**/react-dom": "17.0,2"
  }

Still an issue in npm 7.19.0.

Is this still an issue for anyone? I've been fighting with peer dependencies and checking https://semver.npmjs.com with >=16.x which is what we have listed in package.json includes 17.0.0 and 17.0.1. I'm happy to fix this but I need to be able to reproduce it and then I need to know what to change to fix it.

@robmadole it seems to have been an issue with certain versions of npm, but recent versions have downgraded the error to a warning. I was able to reproduce the issue using npm 7.19.0, but 7.24.2 just warns you and carries on.

Installing with --force or --legacy-peer-deps works, but that's not a reasonable solution for this problem.

EDIT: Did a little more digging, this stack overflow answer was helpful. Looks like the root of the issue is the difference between how npm@6 and npm@7 deals with missing peer dependencies, which is why the --use-legacy-deps works - it's saying to use npm@6's (legacy) behavior instead of the new behavior of npm@7 which is to throw errors and exit.

If you don't want to use --force or --use-legacy-deps you can try adding this to your package.json:

  "resolutions": {
    "**/react": "17.0.2",
    "**/react-dom": "17.0,2"
  }

You've got a comma accidentally in react-dom.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ethan-Arrowood picture Ethan-Arrowood  Â·  4Comments

jonathanazulay picture jonathanazulay  Â·  5Comments

gtkatakura-bysoft picture gtkatakura-bysoft  Â·  5Comments

stevensacks picture stevensacks  Â·  6Comments

lehresman picture lehresman  Â·  6Comments