最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - React Storybook blank page when run - Stack Overflow

programmeradmin3浏览0评论

I am trying to load the demo storybook stories. I created a react app using create-react-app and run npm start. It starts on port: 3000. Then when I run npm run storybook, it opens a browser on port:6006. But displays a blank page only.

I am trying to load the demo storybook stories. I created a react app using create-react-app and run npm start. It starts on port: 3000. Then when I run npm run storybook, it opens a browser on port:6006. But displays a blank page only.

Share Improve this question edited Oct 21, 2020 at 8:11 Drew Reese 203k17 gold badges237 silver badges268 bronze badges asked Oct 21, 2020 at 6:29 Aysha HamnaAysha Hamna 4461 gold badge6 silver badges14 bronze badges 3
  • It is rather difficult to help if you provide next to nothing in the way of details. Are there any errors logged in the console? Can you provide your package.json file? – Drew Reese Commented Oct 21, 2020 at 8:11
  • 1 there are no errors. It just displays a blank page in the browser. and not the demo storybook stories – Aysha Hamna Commented Oct 21, 2020 at 10:39
  • I think there are some errors , open the developer console , I have same problem and it has some problem with React Hooks , – MBehtemam Commented Oct 24, 2020 at 10:06
Add a ment  | 

6 Answers 6

Reset to default 5

What helped me was to run

rm yarn.lock
yarn install

after installing storybook into my project

Apparently react has upgraded to version 17.0.0, but storybook hasn't made the switch yet. If you take version 16.14.0 of react it should work.

https://www.youtube./watch?v=fjb_QcQhRrs

If you wanna stay on react version 17 then you could upgrade storybook to prelease by doing

npx sb@next upgrade --prerelease

for additional information please refer GitHub issue #12408

Try to clear your browser cache. It resolved my issue.

npm ci saved the day for me and fixed the issue

My problem was because I updated @storybook/preset-create-react-app too and it seems I shouldn't have.

When @storybook/preset-create-react-app was reverted back to initial version 3.2.0 in my case, and @storybook/react updated to latest ^6.5.4 - everything was fine.

发布评论

评论列表(0)

  1. 暂无评论