question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fix NPM7 peer dependencies

See original GitHub issue

NPM7 has changed the semantics of peer dependencies which caused NPM to fail: #12983

I updated the CLI to use --legacy-peer-deps to work around this issue: #14106

However, the underlying structure of the project has not changed, and presumably this will bite us in the future.

There are at least two kinds of dependency errors:

  • Dependencies on external libraries like @reach/router which are not React17 compatible
  • Use of optional peer dependencies within Storybook itself, e.g. addon-docs

External libraries

For each library that is not NPM7 compatible, we should either

  • Fork it, make it compatible, issue a PR, replace the fork with the upgrade once PR is merged
  • OR upgrade to an alternative

In the case of @reach/router, the path forward could be React Router which does support React 17

Internal dependencies

@storybook/addon-docs has optional peer dependencies on each of the framework packages it supports @storybook/react, @storybook/vue, etc. It should be refactored to use dependency injection so that those dependencies can be removed. In addition, the react-specific code should probably be moved into @storybook/react, which is a bigger project.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:42
  • Comments:36 (18 by maintainers)

github_iconTop GitHub Comments

8reactions
ndelangencommented, Nov 23, 2021

We recently upgraded to react-router v6!!

7reactions
Jordan-Hallcommented, May 14, 2021

upgrade to react-router 6 but that requires some non-trivial refactoring.

Ok so gonna try and starat this then.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Conflicting peerDependencies npm@7 #191 - GitHub
We suspect it is related to peer dependencies, so we tried with --legacy-peer-deps , with no effect. Is there any documentation explaining how...
Read more >
npm 7 is now generally available! - The GitHub Blog
Automatically installing peer dependencies is an exciting new feature introduced in npm 7. In previous versions of npm (4-6), peer ...
Read more >
Why does NPM 7.17 not install my peer dependencies
With npm@6.x it installs package1 as a link in node_modules of the main project, as expected. It also gives me a warning, that...
Read more >
The Step-by-Step Guide to Understanding and Adopting npm 7
Automatically install peer dependencies along with packages that peer-depend on them. · Ensure that a validly matching peer dependency is found ...
Read more >
How to fix npm dependency hell - Sylhare's blog
The easy fix is to use the npm audit fix which will look for updates that ... You can use the peer dependency...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found