Uncaught TypeError: Cannot read property 'fonts' of undefined
See original GitHub issueDescribe the bug
Ran yarn storybook after installing as per docs. And in browser console this error showed up

System:
System:
OS: macOS 11.0
CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
Binaries:
Node: 13.11.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.13.7 - /usr/local/bin/npm
Browsers:
Chrome: 84.0.4147.125
Firefox: 79.0
Safari: 14.0
npmPackages:
@storybook/addon-actions: ^6.0.6 => 6.0.6
@storybook/addon-essentials: ^6.0.6 => 6.0.6
@storybook/addon-links: ^6.0.6 => 6.0.6
@storybook/node-logger: ^6.0.6 => 6.0.6
@storybook/preset-create-react-app: ^3.1.4 => 3.1.4
@storybook/react: ^6.0.6 => 6.0.6
Issue Analytics
- State:
- Created 3 years ago
- Reactions:27
- Comments:37 (13 by maintainers)
Top Results From Across the Web
Cannot read property 'fontFamily' of undefined" [closed]
This x[i].innerText.trim(). is a string, not a HTML element. It doesn't have style property. You can do simply var font = x[i].style.
Read more >Uncaught TypeError: Cannot read property 'fonts' of undefined
Describe the bug. Ran yarn storybook after installing as per docs. And in browser console this error showed up
Read more >The "Cannot read property 'font' of undefined" error occurs if a ...
The "Cannot read property 'font' of undefined" error occurs if a custom theme name matches one of the default themes.
Read more >Next local fonts is driving me insane: "Cannot read property 'fs ...
What the error tells me, is that the font loader expects 'fs' to be there, which is a Node module. However, if it's...
Read more >Uncaught TypeError: Cannot read property 'value' of undefined
You should really turn off your Autoptimize plugin while you are troubleshooting. Why are you loading your goolge fonts locally through gstatic? Just...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have had the same problem.
When you remove node_modules directory and then run
yarn installornpm install, this errors will disappear.But in my case, after that I had another errors:
I think that the problem is with integration between emotion and storybook after the upgrade by
sb upgradescript. The above errors are from level of emotion code.My package.json:
For me, solution was removing /node_modules and yarn.lock (and then installing everything again). I know that it is not professional solution, but it works.
This is an issue with multiple
@emotion/coredependencies across the tree, which can be helped by forcing the version across all packages. Beware this might break any package using the older versions. In my case I was using@chakra-ui/coredepending on@emotion/core@10.0.35while storybook was depending on@emotion/core@10.0.28, so (I’m hoping) not too big of a change.To force the versions, either do
yarn install --flatand choose the version of the package you want to use, or add aresolutionsfield topackage.jsonwith the package name and the required version, after which you should delete the lock-file and reinstall.For more information, see https://classic.yarnpkg.com/en/docs/cli/install/#toc-yarn-install-flat