storybook: Uncaught TypeError: Object(...) is not a function - @emotion
Describe the bug
When updating @storybook/react to 4.0.7, we are receiving the following error:

To Reproduce Steps to reproduce the behavior:
- Go to https://github.com/IBM/carbon-charts
- Update
@storybook/reactversion inpackages/react/package.jsonto4.0.7 - Run
npm installon the root folder of the repo - Run
npm run storybookinpackages/react
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 18
- Comments: 45 (11 by maintainers)
Commits related to this issue
- Import withStyles directly in components There was an issue where it caused storybook compilation issues. For more info: https://github.com/storybooks/storybook/issues/4796 — committed to conversation/ui by deleted user 6 years ago
- fix: storybookのaddonを全て無効化 https://github.com/storybooks/storybook/issues/4796 — committed to masaki-koide/my-portfolio by masaki-koide 5 years ago
I’m seeing this issue.
Using react 16.6.3, @storybook/react 4.0.9 and @emotion/core 10.0.0
cheers
Support for Emotion 10 is part of Storybook 5.0, which hasn’t reached alpha yet. I’ll post here when it’s ready to try out – ETA next week.
This should not be closed; I’m using React 16.7 and getting the same error.
https://github.com/storybooks/storybook/blob/next/MIGRATION.md#react-163
Please upgrade to React 16.3+ and this problem should go away. We hope to re-introduce support for older versions of React in Storybook 4.1 coming soon.
I’m also seeing this issue
react 16.6.3 @storybook/react 4.0.7 @emotion/core 10.0.4
Also seeing this issue when trying to use emotion for my own components.
Using: React 16.3.2 + @storybook/react 4.0.2 React 16.6.3 + @storybook/react 4.0.2 React 16.6.3 + @storybook/react 4.0.9 And @emotion/core 10.0.0 in all cases.
confirmed 😭
Sorry, forgot to comment on this issue. v5 is in alpha on the
nextNPM tag. Here’s the latest alpha: https://github.com/storybooks/storybook/releases/tag/v5.0.0-alpha.8Upgrade today to try it out. We’re hoping to progress to RC by next week!
@MarcNq This seems to be happening already 😄 https://github.com/storybooks/storybook/issues/4525
I have:
And it’s not working either. 😢
I’m seeing this issue.
Using react 16.7.0-alpha.2, @storybook/4.1.0-alpha.10 and @emotion/core 10.0.1
cheers
UPD: same problem with: @storybook/4.1.0-alpha.11
@angelozehr the original problem was caused by a dependency on react 16.3+ that was introduced in storybook 4.0 due to emotion. Users trying to run older react projects in 4.0 ran into this error. However, in SB4.1 we split the “manager” (UI) and “preview” (user components) into two separate processes so that it was possible to use SB4.1 with older versions of React. Now in 5.0 it appears that the same error message has come back, possibly for a different underlying problem. To make things more difficult/confusing yarn appears to have some weird interactions with Storybook, so in some cases clearing your
node_modulesandyarn.lockfix some dependency-related problems. 😢That’s not a “fix”, it’s a workaround at most. The issue needs to be addressed.
i am using preact instead of react, what changes are required in preact to make this work (basically what is the specific change from old react to 16.3+), also should i open a new bug?
Linking the #4925 pr for reference.
Closing this as a dupe to #8284
To fix this remove all the ‘@emotion’ packages from package.json, remove node_modules and yarn.lock (or package json lock) and yarn install.
@Rolandisimo better than using
alphayou can use 5.0.0-RC1I had the same problem.
After all, I downgraded emotion to 0.x.x and it’s working fine now.
I should have taken the warning message 😅