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.

Storybook resolving wrong dependency version when depended on by both storybook internally and the user's project

See original GitHub issue

Describe the bug I have a react component for which I have created a story for documentation purposes. It depends on the usePopper hook from react-popper@2.2.3. When I render the component using my own webpack server (outside of storybook) it works as expected.

However when I start storybook I get an error stating that usePopper does not exist. After digging around in my node modules I discovered that two of the storybook addons I’m using also depend on react-popper, but a previous version - 1.3.7 via react-popper-tooltip@2.11.1. This version doesn’t export a usePopper hook on which my component depends. To be sure I manually vandalized the source of react-popper@2.2.3 in my node_modules. If it had loaded this version as expected a custom error message would have been thrown, instead I get storybook’s copy.

I’d like to note that I’ve been able to reproduce this behavior repeatedly even after deleting the node_modules folder and installing all dependencies from scratch.

After logging the exported value of the react-popper module in my story, I’ve confirmed that instead of receiving version @2.2.3 of react-popper I’m instead getting the version that ships with the storybook add ons.

npm ls react-popper

+-- @storybook/addon-actions@6.0.0-beta.31
| `-- @storybook/components@6.0.0-beta.31
|   `-- react-popper-tooltip@2.11.1
|     `-- react-popper@1.3.7
+-- @storybook/addon-docs@6.0.0-beta.31
| `-- @storybook/components@6.0.0-beta.31
|   `-- react-popper-tooltip@2.11.1
|     `-- react-popper@1.3.7
+-- react-popper@2.2.3

To Reproduce Steps to reproduce the behavior:

  1. Create a component that depends on the usePopper hook from react-popper@2.2.3 (make sure to add it as a dependency in your package.json).
  2. Create a story for the component and log the exported value of react-popper.
  3. Run storybook.
  4. An error occurs, and you’ll see the older version of react-popper.

Expected behavior The the version of react-popper resolved from the root of my project should be the one imported in the component and story.

System: Note that this isn’t windows specific as it also happens on my mac.

Environment Info: System: OS: Windows 10 10.0.18363 CPU: (8) x64 Intel® Core™ i7-7700K CPU @ 4.20GHz Binaries: Node: 13.12.0 - ~\scoop\apps\nvm\current\nodejs\nodejs\node.EXE Yarn: 1.22.1 - ~\scoop\apps\yarn\current\Yarn\bin\yarn.CMD npm: 6.14.4 - ~\scoop\apps\nvm\current\nodejs\nodejs\npm.CMD Browsers: Edge: 44.18362.449.0 npmPackages: @storybook/addon-a11y: ^5.3.19 => 5.3.19 @storybook/addon-actions: ^6.0.0-beta.31 => 6.0.0-beta.31 @storybook/addon-docs: ^6.0.0-beta.31 => 6.0.0-beta.31 @storybook/addon-knobs: ^6.0.0-beta.31 => 6.0.0-beta.31 @storybook/addon-links: ^6.0.0-beta.31 => 6.0.0-beta.31 @storybook/addon-viewport: ^6.0.0-beta.31 => 6.0.0-beta.31 @storybook/addons: ^6.0.0-beta.31 => 6.0.0-beta.31 @storybook/client-api: ^6.0.0-beta.31 => 6.0.0-beta.31 @storybook/preset-create-react-app: ^3.1.1 => 3.1.1 @storybook/react: ^6.0.0-beta.31 => 6.0.0-beta.31 @storybook/theming: ^6.0.0-beta.31 => 6.0.0-beta.31

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
tim-evanscommented, Aug 3, 2020

I’ve encountered this issue in our application while trying to use the storybook 6.0.0 RC— the error I was getting was:

export 'usePopper' was not found in 'react-popper'

I’m providing this info just to raise this as something that may be helpful to be fixed before releasing 6.0! ✨

The version 3.1.0 of react-popper-tooltip should fix this, but it’d also result in a conflict with older versions of react-popper in apps 😭

1reaction
shilmancommented, Nov 4, 2020

DLLs have been removed in 6.1 so this shouldn’t be a problem anymore. closing!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Frequently Asked Questions - Storybook - JS.ORG
Which community addons are compatible with the latest version of Storybook? Is it possible to browse the documentation for past versions of Storybook?...
Read more >
Next-level component showcasing with Storybook controls
Learn about controls, a new Storybook addon that lets you dynamically interact with your React components for demo and testing purposes.
Read more >
userguide.pdf - Gradle User Manual
Common dependency resolution issues such as resolving version conflicts are covered in. Troubleshooting Dependency Resolution. You can see a dependency tree ...
Read more >
The Gradle build system- Tutorial - Vogella.com
It supports Maven and Ivy repositories for retrieving these dependencies. Gradle supports multi-project and multi-artifact builds. 1.2. Projects ...
Read more >
Error: Can't resolve 'react-bootstrap-validation' - Stack Overflow
if so then please also attach that console, on that case you need to install dependent module also as separately via npm install....
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