-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
addon-docs Error: Cannot read property 'content' of undefined #7577
Comments
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! |
Sorry I somehow missed the notification for this. Did you figure it out? Or upgrade to the latest beta? |
I just hit this issue with the line in question that is failing at runtime is
For me when I set a breakpoint, I find that |
@city41 Thanks so much for the heads up. I know you've been using docs for awhile and there were some changes about how docs are configured over the course of the beta up until the RC. I'm wondering if your config is current. Specifically:
I suggest this because it looks like maybe the |
I did follow the new docs. Still no luck, although we had some webpack config customizations that are probably getting in the way. I'm headed for vacation tomorrow, so I'll be radio silence on this for a couple weeks. I plan to scrap our storybook and webpack config and start over. I'm hoping we can eliminate some of our custom config with more presets. |
@city41 have a great vacation! and when you get back, let me know how i can help. i want to make sure the setup is clean & simple for all but the most custom configurations. |
I just hit the same or a similar error as well, having today updated to 5.2.0 from 5.0.11. I see the same error, unable to read
I went through this installation guide and am using this react preset with no modifications:
I can share my config file if it would be useful. We have previously used addon-readme, addon-ally, addon-viewport and theming with storybook-styled-components:
I'm seeing the error in the Docs tab of all stories, including Let me know if you can add any insight into how we can solve this. Thank you! |
I also had the same issue following the guide (for the first time) |
Same case here... I'll just paste more data here to maybe make it easier to identify. VideoScreen record with all details: https://vimeo.com/360658919 VersionI update from .storybook/.babelrc {
"presets": ["@babel/preset-env", "react-app"]
} addons.js import 'storybook-readme/register';
import '@storybook/addon-actions/register';
import '@storybook/addon-links/register';
import '@storybook/addon-viewport/register';
import '@storybook/addon-a11y/register';
import '@storybook/addon-storysource/register'; config.js import { configure, addDecorator, addParameters } from '@storybook/react';
import { withA11y } from '@storybook/addon-a11y';
import { addReadme } from 'storybook-readme';
/* TODO: Remove this dependency */
// import requireContext from 'require-context.macro';
import './styles.scss';
addDecorator(withA11y);
/* Enable README for all stories */
addDecorator(addReadme);
addParameters({
readme: {
codeTheme: 'github',
StoryPreview: ({ children }) => children
}
});
configure(
require.context('../src', true, /\.stories\.(js|jsx|ts|tsx|mdx)$/),
module
); presets.js module.exports = [
{
name: '@storybook/addon-docs/react/preset',
options: {
configureJSX: true
}
}
]; webpack.config.js const path = require('path');
// Export a function. Accept the base config as the only param.
/* babel-loader is been used to build storybook */
module.exports = async ({ config, mode }) => {
// `mode` has a value of 'DEVELOPMENT' or 'PRODUCTION'
// You can change the configuration based on that.
// 'PRODUCTION' is used when building the static version of storybook.
// Make whatever fine-grained changes you need
config.module.rules.push({
test: /\.scss$/,
loaders: [
'style-loader',
'css-loader',
{
loader: 'postcss-loader',
options: { plugins: () => [require('autoprefixer')()] }
},
'sass-loader'
],
include: path.resolve(__dirname, '../')
});
// **NOTE** If I remove this, does not fix the bug either change anything
config.module.rules.push({
test: /\.stories.jsx?$/,
loaders: [require.resolve('@storybook/addon-storysource/loader')],
enforce: 'pre'
});
// Return the altered config
return config;
}; Unfortunately I cannot share the project because it's an internal one. If you need some other information, let me know. |
Update: I've realized that if I remove my Now I'm trying to figure out which dependency is breaking/impacting directly on storybook. My guess is maybe some from But I still have no evidences of that. @codeincontext @city41 can you also try this approach and see if it works? |
Same case here...DocsPage is expecting theme parameter, otherwise it is giving this error.
|
It worked for me when you delete |
Adding another data point. Also seeing this when upgrading from v5.1.7 to v5.2.1. We're mixing |
Just to follow up on my previous comment. I believe wiping node modules fixed it for us too. Not entirely sure as someone else on my team took over and he successfully upgraded to 5.2.1 without any hiccups. |
To follow up on my comment above, I no longer have this error --
I'm not sure which of these solved it, but one of them did. All working now, thanks @shilman ! |
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! |
upgraded from |
@palashkaria the root cause is that yarn is mistakenly installing multiple versions of a package (maybe emotion?) and one of packages uses module-scoped variables, so when there are multiple versions, only one of the module's variables gets initialized.... it's really ugly. it's possible that there's something funky going on in storybook. but we've seen this in various places and it appears to be a yarn issue. |
I had to delete whole |
@nazarTrynko that did it to me! thanks |
I had a similar problem about |
Same Problem - but even after removing package-log and reinstalling anything it's still not working. |
Had this issue and it was indeed a duplication issue with emotion. Upgrading our (pinned) emotion dependencies fixed the problem for us. I know that the emotion team is working on providing runtime warnings for these issues like react does. NB! I didn't delete the |
I had this issue recently when upgrading to storybook |
Just got it on |
same error here: |
Just a small suggestion. You can check for duplicated packages (eg. emotion in this case) using https://github.com/atlassian/yarn-deduplicate |
Also seeing this on the current 6 alpha #41 - We are using Vue and not doing any custom theming and not including emotion anywhere. I think this might be a way the dependencies are being declared. We use PNPM vs NPM. |
I had multiple storybook versions in my monorepo (lerna) and I had to add |
Try to use <style module ...> property |
Hello everyone. I'm using the newest storybook/react with addon-docs, both version 5.2.0-beta.10. Right now I have a problem running the example from the official Storybook Docs: Technical Preview google docs. When I click Docs panel I get an error
Cannot read property 'content' of undefined
Bug
Steps to reproduce
Configure the new Storybook beta with Docs addon and TypeScript. Run Storybook and click Docs panel.
Please specify which version of Storybook and optionally any affected addons that you're running
Screenshots / Screencast / Code Snippets (Optional)
Storybook config.js
Storybook presets.js
Story
Example Component is a simple
div
withHello
text in it.The text was updated successfully, but these errors were encountered: