[英]Storybook (React): can't find main.js
當我運行yarn storybook
時,我一直面臨一個新創建的故事書項目無法識別main.js
文件的問題。 我在其他項目中使用過故事書,沒有任何問題。
我懷疑這可能與main.js
文件的路徑有關,其中目錄名稱中使用了方括號。 這是 Fivem 用來組織其資源的命名約定。
該圖顯示了我的main.js
文件、項目結構和我在運行yarn storybook
時收到的錯誤。
ERR! Error: No configuration files have been found in your configDir (C:\Users\adam_\Documents\dev\fivem\fxserver\txData\CFXDefault_943D47.base\resources\[UI]\react-fivem\web\.storybook).
ERR! Storybook needs either a "main" or "config" file.
ERR! at validateConfigurationFiles (C:\Users\adam_\Documents\dev\fivem\fxserver\txData\CFXDefault_943D47.base\resources\[UI]\react-fivem\web\node_modules\@storybook\core-common\dist\cjs\utils\validate-configuration-files.js:50:11)
ERR! at loadCustomPresets (C:\Users\adam_\Documents\dev\fivem\fxserver\txData\CFXDefault_943D47.base\resources\[UI]\react-fivem\web\node_modules\@storybook\core-common\dist\cjs\utils\load-custom-presets.js:19:62)
ERR! at loadAllPresets (C:\Users\adam_\Documents\dev\fivem\fxserver\txData\CFXDefault_943D47.base\resources\[UI]\react-fivem\web\node_modules\@storybook\core-common\dist\cjs\presets.js:310:105)
ERR! at buildDevStandalone (C:\Users\adam_\Documents\dev\fivem\fxserver\txData\CFXDefault_943D47.base\resources\[UI]\react-fivem\web\node_modules\@storybook\core-server\dist\cjs\build-dev.js:98:48)
ERR! at processTicksAndRejections (internal/process/task_queues.js:97:5)
ERR! at async buildDev (C:\Users\adam_\Documents\dev\fivem\fxserver\txData\CFXDefault_943D47.base\resources\[UI]\react-fivem\web\node_modules\@storybook\core-server\dist\cjs\build-dev.js:147:5)
ERR! Error: No configuration files have been found in your configDir (C:\Users\adam_\Documents\dev\fivem\fxserver\txData\CFXDefault_943D47.base\resources\[UI]\react-fivem\web\.storybook).
ERR! Storybook needs either a "main" or "config" file.
ERR! at validateConfigurationFiles (C:\Users\adam_\Documents\dev\fivem\fxserver\txData\CFXDefault_943D47.base\resources\[UI]\react-fivem\web\node_modules\@storybook\core-common\dist\cjs\utils\validate-configuration-files.js:50:11)
ERR! at loadCustomPresets (C:\Users\adam_\Documents\dev\fivem\fxserver\txData\CFXDefault_943D47.base\resources\[UI]\react-fivem\web\node_modules\@storybook\core-common\dist\cjs\utils\load-custom-presets.js:19:62)
ERR! at loadAllPresets (C:\Users\adam_\Documents\dev\fivem\fxserver\txData\CFXDefault_943D47.base\resources\[UI]\react-fivem\web\node_modules\@storybook\core-common\dist\cjs\presets.js:310:105)
ERR! at buildDevStandalone (C:\Users\adam_\Documents\dev\fivem\fxserver\txData\CFXDefault_943D47.base\resources\[UI]\react-fivem\web\node_modules\@storybook\core-server\dist\cjs\build-dev.js:98:48)
ERR! at processTicksAndRejections (internal/process/task_queues.js:97:5)
ERR! at async buildDev (C:\Users\adam_\Documents\dev\fivem\fxserver\txData\CFXDefault_943D47.base\resources\[UI]\react-fivem\web\node_modules\@storybook\core-server\dist\cjs\build-dev.js:147:5)
main.js
module.exports = {
"stories": [
"../src/**/*.stories.mdx",
"../src/**/*.stories.@(js|jsx|ts|tsx)"
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/preset-create-react-app"
]
}
我的項目結構中是否有問題可能導致這種情況?
提前致謝
好的,在創建這個之后不久,我將我的react-fivem
目錄向上移動了幾個級別,在main.js
的路徑中沒有使用方括號,並且它開始正常。
我希望這對將來的某人有用!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.