score:0

The issue is caused by npm 7's exciting new feature that automatically installs peer dependencies. This results in both React 16 and React 17 being installed which makes everything explode.

Fortunately you can opt out of the new functionality with:

npm install --legacy-peer-deps

It's less exciting but on the plus side it works.

score:1

React Styleguidist has a peer dependency of "react": ">=16.8". I'm assuming that prior to installing react-styleguidist, you ran npm install --save-dev react, and that would have installed react@17.x.

You have two choices:

  1. Downgrade to React@16.x

    Look at the updates in the changelog or in the summary blog post. If you don't see any must-have changes and are more concerned about the conflicts, downgrade to resolve the peer dependency issue.

  2. Install the peer dependencies anyway

    npm 7.x has more strict error handling for peer dependency issues, and I was able to install these packages on npm 6.x in a React@17 app with no problem, but my colleague hit the same issue and was able to bypass it with npm install --force. Run that and it should work fine. I haven't had any issues yet and have been happily ignoring what is a mere warning on my npm version.


Related Query

More Query from same tag