TypeError: Cannot read property 'lightest' of undefined
See original GitHub issueI have installed Storybook Docs as per the documentation here: https://github.com/storybookjs/storybook/blob/next/addons/docs/README.md#installation
And I have used the Manual preset configuration.
When I view the Docs tab for any of my stories I get the following error:
TypeError: Cannot read property 'lightest' of undefined
at getScrollAreaStyles (http://localhost:6006/vendors~main.e02af6e0f1f31fb510a2.bundle.js:11822:78)
at http://localhost:6006/vendors~main.e02af6e0f1f31fb510a2.bundle.js:41276:100
at updateContextConsumer (http://localhost:6006/vendors~main.e02af6e0f1f31fb510a2.bundle.js:92999:19)
at beginWork (http://localhost:6006/vendors~main.e02af6e0f1f31fb510a2.bundle.js:93187:14)
at performUnitOfWork (http://localhost:6006/vendors~main.e02af6e0f1f31fb510a2.bundle.js:96827:12)
at workLoop (http://localhost:6006/vendors~main.e02af6e0f1f31fb510a2.bundle.js:96867:24)
at renderRoot (http://localhost:6006/vendors~main.e02af6e0f1f31fb510a2.bundle.js:96950:7)
at performWorkOnRoot (http://localhost:6006/vendors~main.e02af6e0f1f31fb510a2.bundle.js:97857:7)
at performWork (http://localhost:6006/vendors~main.e02af6e0f1f31fb510a2.bundle.js:97769:7)
at performSyncWork (http://localhost:6006/vendors~main.e02af6e0f1f31fb510a2.bundle.js:97743:3)
Any ideas what the problem could be or where I could start looking to see the issue?
The packages used are as follows:
"@babel/core": "^7.4.5",
"@storybook/addon-docs": "^5.2.0-beta.46",
"@storybook/addon-knobs": "^5.2.0-beta.46",
"@storybook/addon-notes": "^5.2.0-beta.46",
"@storybook/html": "^5.2.0-beta.46",
"babel-loader": "^8.0.6",
"webpack": "^4.39.3"
The config.js
file is as follows:
import { addParameters, configure } from '@storybook/html';
import { themes } from '@storybook/theming';
import yourTheme from './yourTheme';
import { DocsPage, DocsContainer } from '@storybook/addon-docs/blocks';
// automatically import all files ending in *.stories.js
const req = require.context('../stories', true, /\.stories\.(js|mdx)$/);
function loadStories() {
req.keys().forEach(filename => req(filename));
}
// Option defaults:
addParameters({
docs: {
container: DocsContainer,
page: DocsPage
},
options: {
/**
* show story component as full screen
* @type {Boolean}
*/
isFullscreen: false,
/**
* display panel that shows a list of stories
* @type {Boolean}
*/
showNav: true,
/**
* display panel that shows addon configurations
* @type {Boolean}
*/
showPanel: true,
/**
* where to show the addon panel
* @type {('bottom'|'right')}
*/
panelPosition: 'bottom',
/**
* sorts stories
* @type {Boolean}
*/
sortStoriesByKind: false,
/**
* regex for finding the hierarchy separator
* @example:
* null - turn off hierarchy
* /\// - split by `/`
* /\./ - split by `.`
* /\/|\./ - split by `/` or `.`
* @type {Regex}
*/
hierarchySeparator: /\/|\./,
/**
* regex for finding the hierarchy root separator
* @example:
* null - turn off multiple hierarchy roots
* /\|/ - split by `|`
* @type {Regex}
*/
hierarchyRootSeparator: /\|/,
/**
* sidebar tree animations
* @type {Boolean}
*/
sidebarAnimations: true,
/**
* enable/disable shortcuts
* @type {Boolean}
*/
enableShortcuts: false,
/**
* show/hide tool bar
* @type {Boolean}
*/
isToolshown: true,
/**
* theme storybook, see link below
*/
theme: themes.light
}
});
// must come last
configure(loadStories, module);
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:53 (12 by maintainers)
Top Results From Across the Web
Cannot read property 'light' of undefined · Issue #7320 - GitHub
The error is Cannot read property 'light' of undefined. I have enclosed an image of the stack trace in the simulator. The problem...
Read more >How to solve the following TypeError: Cannot read properties ...
Error says you can't read properties of undefined, which means they're trying to access properties of an object, where the object is ...
Read more >Uncaught TypeError : Cannot read properties of undefined
The TypeError occurs when a variable or parameter is not of a valid type. Common Scenarios: Invoking objects that are not methods; Attempting...
Read more >How to Read React Errors (fix 'Cannot read property of ...
TypeError is the kind of error. There are a handful of built-in error types. · Cannot read property means the code was trying...
Read more >Why is the error "Cannot read properties of undefined (reading ...
The problem turned out to be with targeting this.template.host.style . I stopped doing this and instead used the querySelector() method ...
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
@seanmhanson what happens when you run
yarn list @storybook/theming
(or whatever the npm equivalent is) oryarn list @emotion/core
. i suspect that there’s some package that should be a singleton, that’s actually installed multiple times in your project due to some yarn/npm weirdness.If you find that there are multiple copies installed, try installing
@storybook/theming
, clearing your lockfile, and re-generating.Just a hunch…
This same issue had occurred for us yesterday after updating our
yarn.lock
(without updating storybook). Removingyarn.lock
,node_modules
did not helped.I found out, that for some reason we had two
@emotion/core
inyarn.lock
. We use emotionJS in our project aswell, the version in ourpackage.json
was10.0.27
. (I remember I already had to bump the version once to .27 when moving to SB 5.3). Bumping the version of@emotion/core
in ourpackage.json
to10.0.28
helped to have just one@emotion/core
inyarn.lock
.Posting this here, because maybe it will help someone.