Storybook: Uncaught TypeError: context.stylis is not a function

Created on 14 Mar 2019  ·  10Comments  ·  Source: storybookjs/storybook

Describe the bug
Storybook build but in the window (localhost:6006) I get the following console error:
Uncaught TypeError: context.stylis is not a function

image

System:

  • OS: MacOS (High Sierra)
  • Device: MacBook Pro mid 105
  • Browser: chrome
  • Framework: react
  • Addons: [if relevant]
  • Version: 5.0.1
compatibility with other tools has workaround question / support yarn / npm

All 10 comments

Looks like you need to wrap your stories with some provider that adds stylis to the context in config.js, e.g.

addDecorator(storyFn => <SomeProvider>{storyFn()}</SomeProvider>)

But I don't know enough about stylis or your project to know what that provider would be

Could you share code snippet for reproduce this?

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

Also have this problem and I'm not using stylis

I also had this problem on a storybook project. I deleted the contents of the .cache folder in the repo and restarted my storybook server. The error is gone. Not sure what caused the issue to manifest in the first place though.

Clearing node_modules fixed the problem for me. Deleting only the .cache folder was not enough 🤷‍♂️

@Armanio, sorry for the late response. I think I did the same @RickyMarou and it fixed my issue.
Hard to create a snippet for that.

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

I actually got this same issue when upgrading from v4 -> v5. I'm using Lerna + Yarn Workspaces and just had to delete all node_modules/ and was good to go

remove node_modules solve my problem

Was this page helpful?
0 / 5 - 0 ratings