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:

image

To Reproduce Steps to reproduce the behavior:

  1. Go to https://github.com/IBM/carbon-charts
  2. Update @storybook/react version in packages/react/package.json to 4.0.7
  3. Run npm install on the root folder of the repo
  4. Run npm run storybook in packages/react

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 18
  • Comments: 45 (11 by maintainers)

Commits related to this issue

Most upvoted comments

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 next NPM tag. Here’s the latest alpha: https://github.com/storybooks/storybook/releases/tag/v5.0.0-alpha.8

Upgrade 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:

"@emotion/core": "^10.0.5",
"@emotion/styled": "^10.0.5",
"@storybook/react": "^4.1.1",
"react": "^16.5.1",
"react-dom": "^16.5.1"

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_modules and yarn.lock fix 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 alpha you can use 5.0.0-RC1

I 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 😅

warning "@storybook/addon-knobs > @emotion/styled > @emotion/styled-base@0.10.6" has incorrect peer dependency "@emotion/core@0.x.x".