首页 > 解决方案 > NPM 安装/Babel 或 Gatsby 问题后 Storybook 失败?

问题描述

我一直在成功运行 storybook,但最近 npm 安装了 jest,这导致我的整个 package.json 更新并且 storybook 坏了。不知道从哪里开始(babel 或 gatsby 的问题?),但是当我尝试运行故事书时,这是我的终端的错误:

> 
>     ERROR in ./node_modules/gatsby/cache-dir/navigation.js
>     Module not found: Error: Can't resolve './redirects.json' in '/Users/zmason/Documents/code/resourcehub-components/node_modules/gatsby/cache-dir'
>      @ ./node_modules/gatsby/cache-dir/navigation.js 12:17-44
>      @ ./node_modules/gatsby/cache-dir/page-renderer.js
>      @ ./node_modules/gatsby/cache-dir/public-page-renderer-prod.js
>      @ ./node_modules/gatsby/cache-dir/public-page-renderer.js
>      @ ./node_modules/gatsby/cache-dir/gatsby-browser-entry.js
>      @ ./src/components/Card/LinkCard.js
>      @ ./stories/index.stories.js
>      @ ./.storybook/config.js
>      @ multi ./node_modules/@storybook/react/dist/server/config/polyfills.js
> ./node_modules/@storybook/react/dist/server/config/globals.js
> (webpack)-hot-middleware/client.js?reload=true ./.storybook/config.js
>     Child html-webpack-plugin for "iframe.html":
>               Asset    Size  Chunks  Chunk Names
>         iframe.html  569 kB       0
>            [0] ./node_modules/html-webpack-plugin/lib/loader.js!./node_modules/@storybook/react/dist/server/iframe.html.ejs
> 1.16 kB {0} [built]
>            [1] ./node_modules/lodash/lodash.js 540 kB {0} [built]
>            [2] (webpack)/buildin/global.js 509 bytes {0} [built]
>            [3] (webpack)/buildin/module.js 517 bytes {0} [built]
>     Child html-webpack-plugin for "index.html":
>              Asset    Size  Chunks  Chunk Names
>         index.html  569 kB       0
>            [0] ./node_modules/html-webpack-plugin/lib/loader.js!./node_modules/@storybook/react/dist/server/index.html.ejs
> 1.7 kB {0} [built]
>            [1] ./node_modules/lodash/lodash.js 540 kB {0} [built]
>            [2] (webpack)/buildin/global.js 509 bytes {0} [built]
>            [3] (webpack)/buildin/module.js 517 bytes {0} [built]
> 
> 

任何帮助都会很大!

标签: npmjestjsbabeljsgatsbystorybook

解决方案


推荐阅读