gpt4 book ai didi

reactjs - 故事书 throw 错误

转载 作者:行者123 更新时间:2023-12-03 13:41:23 25 4
gpt4 key购买 nike

我一直试图弄清楚发生了什么但没有任何成功。我试过重新安装、更新 babel、更改脚本(我在寻找解决方案时发现的各种东西),但似乎没有任何效果。
我按照故事书指南,最初运行:

npx -p @storybook/cli sb init
然后 yarn storybook并收到此错误:
./.storybook/generated-stories-entry.js] 1.41 KiB {main} [built] [failed] [1 error]
[./.storybook/preview.js-generated-config-entry.js] 1.41 KiB {main} [built] [failed] [1 error]
[./.storybook/storybook-init-framework-entry.js] 1.41 KiB {main} [built] [failed] [1 error]
[./node_modules/@storybook/addon-actions/dist/preset/addArgs.js] 2.41 KiB {vendors~main} [built]
[./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js] 2.24 KiB {vendors~main} [built]
[./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js] 216 bytes {vendors~main} [built]
[./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js] 2.25 KiB {vendors~main} [built]
[./node_modules/@storybook/addon-backgrounds/dist/preset/defaultParameters.js-generated-other-entry.js] 2.26 KiB {vendors~main} [built]
[./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js] 2.25 KiB {vendors~main} [built]
[./node_modules/@storybook/addon-docs/dist/frameworks/react/config.js-generated-other-entry.js] 2.25 KiB {vendors~main} [built]
[./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js] 2.25 KiB {vendors~main} [built]
[./node_modules/@storybook/core/dist/server/common/polyfills.js] 120 bytes {vendors~main} [built]
[./node_modules/@storybook/core/dist/server/preview/globals.js] 93 bytes {vendors~main} [built]
[./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined] 7.68 KiB {vendors~main} [built]
+ 411 hidden modules

ERROR in ./.storybook/storybook-init-framework-entry.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module 'C:\Users\Avner\Desktop\NewLib\ewlib\node_modules\min-indent\index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:316:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:705:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:969:27)
at Function.Module._load (internal/modules/cjs/loader.js:864:27)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (C:\Users\Avner\Desktop\NewLib\ewlib\node_modules\strip-indent\index.js:2:19)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (C:\Users\Avner\Desktop\NewLib\ewlib\node_modules\react-docgen\dist\utils\printValue.js:10:43)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/storybook-init-framework-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/react/config.js-generated-other-entry.js ./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/defaultParameters.js-generated-other-entry.js ./.storybook/preview.js-generated-config-entry.js ./.storybook/generated-stories-entry.js ./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined main[2]

ERROR in ./.storybook/generated-stories-entry.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module 'C:\Users\Avner\Desktop\NewLib\ewlib\node_modules\min-indent\index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:316:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:705:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:969:27)
at Function.Module._load (internal/modules/cjs/loader.js:864:27)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (C:\Users\Avner\Desktop\NewLib\ewlib\node_modules\strip-indent\index.js:2:19)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (C:\Users\Avner\Desktop\NewLib\ewlib\node_modules\react-docgen\dist\utils\printValue.js:10:43)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/storybook-init-framework-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/react/config.js-generated-other-entry.js ./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/defaultParameters.js-generated-other-entry.js ./.storybook/preview.js-generated-config-entry.js ./.storybook/generated-stories-entry.js ./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined main[10]

ERROR in ./.storybook/preview.js-generated-config-entry.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module 'C:\Users\Avner\Desktop\NewLib\ewlib\node_modules\min-indent\index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:316:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:705:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:969:27)
at Function.Module._load (internal/modules/cjs/loader.js:864:27)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (C:\Users\Avner\Desktop\NewLib\ewlib\node_modules\strip-indent\index.js:2:19)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (C:\Users\Avner\Desktop\NewLib\ewlib\node_modules\react-docgen\dist\utils\printValue.js:10:43)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/storybook-init-framework-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/react/config.js-generated-other-entry.js ./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/defaultParameters.js-generated-other-entry.js ./.storybook/preview.js-generated-config-entry.js ./.storybook/generated-stories-entry.js ./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined main[9]
Child HtmlWebpackCompiler:
Asset Size Chunks Chunk Names
__child-HtmlWebpackPlugin_0 6.48 KiB HtmlWebpackPlugin_0 HtmlWebpackPlugin_0
Entrypoint HtmlWebpackPlugin_0 = __child-HtmlWebpackPlugin_0
[./node_modules/@storybook/core/node_modules/html-webpack-plugin/lib/loader.js!./node_modules/@storybook/core/dist/server/templates/index.ejs] 2.13 KiB {HtmlWebpackPlugin_0} [built]

WARN Broken build, fix the error above.
WARN You may need to refresh the browser.

最佳答案

错误日志指出您的 min-indent您的 node_modules 中可能缺少包裹无论出于何种原因文件夹。

Error: Cannot find module 'C:\Users\Avner\Desktop\NewLib\ewlib\node_modules\min-indent\index.js'. Please verify that the package.json has a valid "main" entry


我对 storybook github 问题进行了快速搜索,这个错误似乎至少可以通过 3 种方式解决:
1)尝试重新安装软件包:
// w/ npm

npm i min-indent

// w/ yarn

yarn add min-indent

来自 github 的示例解决方案:
  • https://github.com/storybookjs/storybook/issues/13851#issuecomment-776798296
  • https://github.com/storybookjs/storybook/issues/13980

  • 2) 仔细检查上述包是否在您的 package.json 中依赖列表。
    特定包可能是您 package.json 中声明的另一个包的依赖项。 .在这种情况下,它不需要列出,您可以尝试步骤 3。
    来自 github 的示例解决方案:
  • https://github.com/storybookjs/storybook/issues/13597#issuecomment-758297144

  • 3) 删除您的 node_modules文件夹和 package-lock.json文件,然后完全重新安装本地软件包。
    npm i
    来自 github 的示例解决方案:
  • https://github.com/storybookjs/storybook/issues/4764#issuecomment-452747862
  • 请注意,此答案说不要删除您的 package-lock.json ,而是尝试不同的卸载/安装顺序。值得一试。

  • https://github.com/storybookjs/storybook/issues/13203#issuecomment-731697914

  • 看起来他们的 github issues 中有几个例子版本更新可能会导致一些包中断。如果上述解决方案不起作用,请尝试在他们的 github 上提交问题。看起来故事书团队 react 灵敏,将帮助您开始工作!

    关于reactjs - 故事书 throw 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63783838/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com