How to fix "Cannot GET /” when running Storybook
If you have ever run Storybook successfully but got "Cannot GET /” display in the browser? There is a simple fix for this problem.
What is the bug?
When you run
start-storybook, it seems to work correctly, and prints out this message in the terminal:
╭────────────────────────────────────────────────────╮ │ │ │ Storybook 6.4.17 for React started │ │ 21 s for manager and 23 s for preview │ │ │ │ Local: http://localhost:6006/ │ │ On your network: http://192.168.1.223:6006/ │ │ │ ╰────────────────────────────────────────────────────╯
However, when you open the localhost link in the browser, you only see this:
Cannot GET /
"Cannot GET /” solution
A lot of suggestions recommend removing
node_modules and reinstalling. While you can try this, it doesn't always work as sometimes the issue is saved in Storybook cache.
If removing and reinstalling
node_modules doesn't work for you then run
start-storybook once with the
-no-manager-cache flag. This will clear any stored Storybook cache and the project should hopefully boot up and load in the browser correctly.
npm start-storybook -no-manager-cache
You only need to use this flag once as after that, the cache should be in a good state. The storybook docs advise against using this flag all the time for performance reasons: https://storybook.js.org/docs/react/api/cli-options
💡 The flag --no-manager-cache disables the internal caching of Storybook and can severely impact your Storybook loading time, so only use it when you need to refresh Storybook's UI, such as when editing themes.