Skip to content
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

Core: Make sure cache is available before trying to use it #13012

Merged
merged 5 commits into from Nov 6, 2020

Conversation

ho1234c
Copy link
Contributor

@ho1234c ho1234c commented Nov 4, 2020

I encountered error as below. so I could not start story book dev server. I try remove and install node_moudles many time but still broken.

info => Loading presets
info => Loading presets
info => Loading 1 config file in "libs/design-system/.storybook"
info => Loading 6 other files in "libs/design-system/.storybook"
ERR! TypeError: Cannot read property 'remove' of undefined
ERR!     at startManager (/Users/jonghojeong/source/dano-frontend/node_modules/@storybook/core/dist/server/dev-server.js:288:21)
ERR!     at async Promise.all (index 1)
ERR!     at async storybookDevServer (/Users/jonghojeong/source/dano-frontend/node_modules/@storybook/core/dist/server/dev-server.js:426:28)
ERR!     at async Object.buildDevStandalone (/Users/jonghojeong/source/dano-frontend/node_modules/@storybook/core/dist/server/build-dev.js:306:33)
ERR!  TypeError: Cannot read property 'remove' of undefined
ERR!     at startManager (/Users/jonghojeong/source/dano-frontend/node_modules/@storybook/core/dist/server/dev-server.js:288:21)
ERR!     at async Promise.all (index 1)
ERR!     at async storybookDevServer (/Users/jonghojeong/source/dano-frontend/node_modules/@storybook/core/dist/server/dev-server.js:426:28)
ERR!     at async Object.buildDevStandalone (/Users/jonghojeong/source/dano-frontend/node_modules/@storybook/core/dist/server/build-dev.js:306:33) {
ERR!   stack: "TypeError: Cannot read property 'remove' of undefined\n" +
ERR!     '    at startManager (/Users/jonghojeong/source/dano-frontend/node_modules/@storybook/core/dist/server/dev-server.js:288:21)\n' +
ERR!     '    at async Promise.all (index 1)\n' +
ERR!     '    at async storybookDevServer (/Users/jonghojeong/source/dano-frontend/node_modules/@storybook/core/dist/server/dev-server.js:426:28)\n' +
ERR!     '    at async Object.buildDevStandalone (/Users/jonghojeong/source/dano-frontend/node_modules/@storybook/core/dist/server/build-dev.js:306:33)'
ERR! }

What I did

I think file system cache is fragile. in my case, don't know why, but the cache is broken.
so I add logic to prevent non-execution in the event of cache problem.
It is nit change but since I spent a lot of time to find solution, I hope it helps someone.

and I modified eslint rule to pass commit lint.

@ghengeveld
Copy link
Member

Good call @ho1234c! What's up with the changes to .eslintrc.js? Those seem completely unrelated.

@ghengeveld ghengeveld changed the title Add protection against cache usage Make sure cache is available before trying to use it Nov 6, 2020
Copy link
Member

@ghengeveld ghengeveld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. I left some remarks.

lib/core/src/server/dev-server.ts Outdated Show resolved Hide resolved
.eslintrc.js Outdated Show resolved Hide resolved
@ghengeveld ghengeveld assigned ho1234c and unassigned ghengeveld Nov 6, 2020
@ho1234c
Copy link
Contributor Author

ho1234c commented Nov 6, 2020

I see. optional chaining is best..!

Copy link
Member

@ghengeveld ghengeveld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks for contributing and pulling it through!

@shilman shilman changed the title Make sure cache is available before trying to use it Core: Make sure cache is available before trying to use it Nov 6, 2020
@shilman shilman merged commit eac05fe into storybookjs:next Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants