rescript-lang/rescript-react

Be careful about peer dependency

bobzhang opened this issue · 4 comments

Note npm@7 is more strict with peerDependencies, I do not have time to think about it yet, here are issues I found.

This package have 3 peer dependencies:

  "bs-platform": "^8.3.0",
   "react": "^16.8.1",
   "react-dom": "^16.8.1"

So, you will have an installation error (by default), if you have a different version of this package in your own package.json. For example, if I have bs-platform@9.0.1 installed, here is the error message I got:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: bs-platform@9.0.1
npm ERR! node_modules/bs-platform
npm ERR!   dev bs-platform@"9.0.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer bs-platform@"^8.3.0" from @rescript/react@0.10.1
npm ERR! node_modules/@rescript/react
npm ERR!   @rescript/react@"^0.10.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.
npm ERR! 
npm ERR! See /Users/hongbozhang/.npm/eresolve-report.txt for a full report.

The work around is using --legacy-peer-deps as suggested

uff, i generally dislike peerDependencies... i wonder if we actually need them? maybe easier to just drop them and document the version constraints in the README

I stumbled with the same issue.. it's practically a spaghetti of peer dependencies. Now I regret having so many deps

we removed the peerdep for now and released a new bugfix version!

MoOx commented

There are still issues with react version. I created a PR for this #41