Storybook cannot find fetch-mock module

637 Views Asked by At

None of my storybooks stories are working anymore, and I am not sure if its an environmental or code issue.

It cannot find modules in fetch-mock/es5/client.js importing js/modules/es6.*.

The only difference that I can think of is that I added a new node module (react-syntax-highlighter). However nothing in the stack trace points to that... it is just pointing to "fetch-mock"

ERROR in ./node_modules/fetch-mock/es5/client.js
Module not found: Error: Cannot find module 'core-js/modules/es6.regexp.match'
 @ ./node_modules/fetch-mock/es5/client.js 113:0-43
 @ ./stories/cyberdashImport.stories.js
 @ ./stories sync \.stories\.js$
 @ ./.storybook/config.js
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/config.js ./node_modules/webpack-hot-middleware
/client.js?reload=true
2

There are 2 best solutions below

0
On

I solved this by switching over to npm instead of yarn.

I deleted my node_modules, and then did a npm install, and everything works fine. Yarn seems to have problems resolving dependencies with storybook.

0
On

Had a similar issue. Deleted node_modules and run npm install again. It fixed my issue.