react-chess / chessground

Chessground React Wrapper
https://www.npmjs.com/package/@react-chess/chessground
GNU General Public License v3.0
29 stars 5 forks source link

Peer deps preclude using React 17 without `--force` flag for `npm install` #6

Closed johnislarry closed 2 years ago

johnislarry commented 2 years ago

Because the peer deps in this package target react@"^16.8.0", if your project uses react@17.0.2, then you get the following error when running npm install @react-chess/chessground.

johnislarry@MAXS:/mnt/c/Users/Max/chessstudytool$ npm install --save @react-chess/chessground
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: chessstudytool@undefined
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"17.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0" from @react-chess/chessground@1.2.0
npm ERR! node_modules/@react-chess/chessground
npm ERR!   @react-chess/chessground@"*" 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.
npm ERR!
npm ERR! See /home/johnislarry/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/johnislarry/.npm/_logs/2022-01-16T05_17_20_557Z-debug-0.log

I'm not sure if it was intentional to not support the most recent version of react, but I'm assuming (maybe incorrectly) that you wanted to support both 16.x and 17.x. If that's the case, you could use the || operator in the semver expression in your package.json like in this post: https://stackoverflow.com/questions/47309598/make-your-npm-package-support-multiple-versions-of-peer-depedency

H-Richard commented 2 years ago

Should be fixed as of version 1.2.1!