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.

Cannot read property 'displayName' of undefined

See original GitHub issue

Describe the bug

Test suite failed to run

    TypeError: Cannot read property 'displayName' of undefined

      1 | import initStoryshots from '@storybook/addon-storyshots'
      2 | 
    > 3 | initStoryshots({
        |               ^
      4 |   framework: 'react-native',
      5 | })
      6 | 

      at getDisplayName (node_modules/@emotion/primitives-core/dist/primitives-core.cjs.dev.js:232:64)
      at Function.createStyledComponent (node_modules/@emotion/primitives-core/dist/primitives-core.cjs.dev.js:225:41)
      at Object.<anonymous> (node_modules/@storybook/react-native/dist/preview/components/StoryListView/index.js:110:20)
      at Object.<anonymous> (node_modules/@storybook/react-native/dist/preview/components/OnDeviceUI/index.js:46:45)
      at Object.<anonymous> (node_modules/@storybook/react-native/dist/preview/index.js:58:42)
      at Object.<anonymous> (node_modules/@storybook/react-native/dist/index.js:12:39)
      at Object.load (node_modules/@storybook/addon-storyshots/dist/frameworks/rn/loader.js:36:29)
      at loadFramework (node_modules/@storybook/addon-storyshots/dist/frameworks/frameworkLoader.js:31:17)
      at Object.testStorySnapshots [as default] (node_modules/@storybook/addon-storyshots/dist/api/index.js:53:36)
      at Object.<anonymous> (__tests__/storyshots.spec.ts:3:15)

System:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

70reactions
duilio92commented, Jan 12, 2021

In my case I got the error by importing {Component} instead of Componet without the curly braces

47reactions
liranh85commented, Mar 3, 2021

In my case it was because I imported the component as a named import instead of default import.

So I fixed it from this:

import { Button } from './Button';

To this:

import Button from './Button';
Read more comments on GitHub >

github_iconTop Results From Across the Web

Storybook cannot read property 'displayName' of undefined
Apparently, I was importing a Navbar, my component's name is Header. Also there is a difference between export default function () {} and ......
Read more >
How to fix the error “Cannot read property 'displayName' of ...
The other day, I got the error “Cannot read property 'displayName' of undefined” in my project. The specs of my project are as...
Read more >
Cannot read property 'displayName' of undefined
Hi. happens in quite all of my flows,. Flow ID 708c7cf1-1bb2-4dfb-bcbc-3326b33c75c1. Flow ID 9dedfade-9002-4ec6-88a7-9f3ceceb0577.
Read more >
cannot read properties of undefined (reading 'displayname ...
Here's an example of a JavaScript TypeError: Cannot read property of undefined thrown when a property is attempted to be read on an...
Read more >
Error Parsing NME Snippet - `TypeError: Cannot set property ...
TypeError : Cannot set property 'displayName' of undefined is reported when trying to load my NME snippet ( #YDTJYX#2 ) in Babylon v4.2.0....
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