admin管理员组

文章数量:1245898

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.

本文标签: javascriptReact Storybook blank page when runStack Overflow