我的Storybook配置出现问题。
已安装的软件包:
"@storybook/addon-actions": "^5.0.6",
"@storybook/addon-console": "^1.0.0",
"@storybook/addon-info": "^5.0.6",
"@storybook/addon-links": "^5.0.6",
"@storybook/addon-storyshots": "^5.0.6",
"@storybook/addons": "^5.0.6",
"@storybook/channels": "^5.0.6",
"@storybook/react": "^5.0.6",
"@storybook/theming": "^5.0.6",
.storybook/config.js
:
import { configure } from '@storybook/react';
import '@storybook/addon-console';
import '@storybook/addon-links/register';
import { setDefaults } from '@storybook/addon-info';
// Allow jest mocking in Storyshots without affecting Storybook
global.jest = {
mock: () => {}
};
const req = require.context('../app/bundles/', true, /\.stories\.jsx$/);
function loadStories() {
req.keys().forEach(filename => req(filename));
}
setDefaults({
inline: true
})
configure(loadStories, module);
错误消息:
ERROR in ./node_modules/@storybook/addon-info/dist/components/markdown/code.js
Module not found: Error: Can't resolve '@storybook/components' in '/Users/briengivens/upstart/upstart_web/client/node_modules/@storybook/addon-info/dist/components/markdown'
@ ./node_modules/@storybook/addon-info/dist/components/markdown/code.js 23:18-50
@ ./node_modules/@storybook/addon-info/dist/components/markdown/index.js
@ ./node_modules/@storybook/addon-info/dist/index.js
@ ./app/bundles/Shared/stories/AsyncDropdown.stories.jsx
@ ./app/bundles sync \.stories\.jsx$
@ ./.storybook/config.js
@ ./storybooks/upstart/config.js
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./storybooks/upstart/config.js (webpack)-hot-middleware/client.js?reload=true
如果我yarn add -D @storybook/components
,我会得到
ERROR in ./node_modules/@storybook/components/dist/tooltip/WithTooltip.js
Module not found: Error: Can't resolve 'react-popper-tooltip' in '/Users/briengivens/upstart/upstart_web/client/node_modules/@storybook/components/dist/tooltip'
@ ./node_modules/@storybook/components/dist/tooltip/WithTooltip.js 46:49-80
@ ./node_modules/@storybook/components/dist/index.js
@ ./node_modules/@storybook/addon-info/dist/components/markdown/code.js
@ ./node_modules/@storybook/addon-info/dist/components/markdown/index.js
@ ./node_modules/@storybook/addon-info/dist/index.js
@ ./.storybook/config.js
@ ./storybooks/upstart/config.js
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./storybooks/upstart/config.js (webpack)-hot-middleware/client.js?reload=true
ERROR in ./node_modules/@storybook/components/dist/syntaxhighlighter/syntaxhighlighter.js
Module not found: Error: Can't resolve 'react-syntax-highlighter/languages/prism/bash' in '/Users/briengivens/upstart/upstart_web/client/node_modules/@storybook/components/dist/syntaxhighlighter'
@ ./node_modules/@storybook/components/dist/syntaxhighlighter/syntaxhighlighter.js 50:35-91
@ ./node_modules/@storybook/components/dist/index.js
@ ./node_modules/@storybook/addon-info/dist/components/markdown/code.js
@ ./node_modules/@storybook/addon-info/dist/components/markdown/index.js
@ ./node_modules/@storybook/addon-info/dist/index.js
@ ./.storybook/config.js
@ ./storybooks/upstart/config.js
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./storybooks/upstart/config.js (webpack)-hot-middleware/client.js?reload=true
ERROR in ./node_modules/@storybook/components/dist/syntaxhighlighter/syntaxhighlighter.js
Module not found: Error: Can't resolve 'react-syntax-highlighter/languages/prism/css' in '/Users/briengivens/upstart/upstart_web/client/node_modules/@storybook/components/dist/syntaxhighlighter'
@ ./node_modules/@storybook/components/dist/syntaxhighlighter/syntaxhighlighter.js 52:34-89
@ ./node_modules/@storybook/components/dist/index.js
@ ./node_modules/@storybook/addon-info/dist/components/markdown/code.js
@ ./node_modules/@storybook/addon-info/dist/components/markdown/index.js
@ ./node_modules/@storybook/addon-info/dist/index.js
@ ./.storybook/config.js
@ ./storybooks/upstart/config.js
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./storybooks/upstart/config.js (webpack)-hot-middleware/client.js?reload=true
ERROR in ./node_modules/@storybook/components/dist/syntaxhighlighter/syntaxhighlighter.js
Module not found: Error: Can't resolve 'react-syntax-highlighter/languages/prism/jsx' in '/Users/briengivens/upstart/upstart_web/client/node_modules/@storybook/components/dist/syntaxhighlighter'
@ ./node_modules/@storybook/components/dist/syntaxhighlighter/syntaxhighlighter.js 48:34-89
@ ./node_modules/@storybook/components/dist/index.js
@ ./node_modules/@storybook/addon-info/dist/components/markdown/code.js
@ ./node_modules/@storybook/addon-info/dist/components/markdown/index.js
@ ./node_modules/@storybook/addon-info/dist/index.js
@ ./.storybook/config.js
@ ./storybooks/upstart/config.js
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./storybooks/upstart/config.js (webpack)-hot-middleware/client.js?reload=true
ERROR in ./node_modules/@storybook/components/dist/syntaxhighlighter/syntaxhighlighter.js
Module not found: Error: Can't resolve 'react-syntax-highlighter/languages/prism/markup' in '/Users/briengivens/upstart/upstart_web/client/node_modules/@storybook/components/dist/syntaxhighlighter'
@ ./node_modules/@storybook/components/dist/syntaxhighlighter/syntaxhighlighter.js 54:37-95
@ ./node_modules/@storybook/components/dist/index.js
@ ./node_modules/@storybook/addon-info/dist/components/markdown/code.js
@ ./node_modules/@storybook/addon-info/dist/components/markdown/index.js
@ ./node_modules/@storybook/addon-info/dist/index.js
@ ./.storybook/config.js
@ ./storybooks/upstart/config.js
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./storybooks/upstart/config.js (webpack)-hot-middleware/client.js?reload=true
ERROR in ./node_modules/@storybook/components/dist/syntaxhighlighter/syntaxhighlighter.js
Module not found: Error: Can't resolve 'react-syntax-highlighter/prism-light' in '/Users/briengivens/upstart/upstart_web/client/node_modules/@storybook/components/dist/syntaxhighlighter'
@ ./node_modules/@storybook/components/dist/syntaxhighlighter/syntaxhighlighter.js 56:42-89
@ ./node_modules/@storybook/components/dist/index.js
@ ./node_modules/@storybook/addon-info/dist/components/markdown/code.js
@ ./node_modules/@storybook/addon-info/dist/components/markdown/index.js
@ ./node_modules/@storybook/addon-info/dist/index.js
@ ./.storybook/config.js
@ ./storybooks/upstart/config.js
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./storybooks/upstart/config.js (webpack)-hot-middleware/client.js?reload=true
ERROR in ./node_modules/@storybook/components/dist/form/input/input.js
Module not found: Error: Can't resolve 'react-textarea-autosize' in '/Users/briengivens/upstart/upstart_web/client/node_modules/@storybook/components/dist/form/input'
@ ./node_modules/@storybook/components/dist/form/input/input.js 16:52-86
@ ./node_modules/@storybook/components/dist/form/index.js
@ ./node_modules/@storybook/components/dist/index.js
@ ./node_modules/@storybook/addon-info/dist/components/markdown/code.js
@ ./node_modules/@storybook/addon-info/dist/components/markdown/index.js
@ ./node_modules/@storybook/addon-info/dist/index.js
@ ./.storybook/config.js
@ ./storybooks/upstart/config.js
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./storybooks/upstart/config.js (webpack)-hot-middleware/client.js?reload=true
ERROR in ./node_modules/@storybook/components/dist/form/input/input.js
Module not found: Error: Can't resolve 'recompose' in '/Users/briengivens/upstart/upstart_web/client/node_modules/@storybook/components/dist/form/input'
@ ./node_modules/@storybook/components/dist/form/input/input.js 14:17-37
@ ./node_modules/@storybook/components/dist/form/index.js
@ ./node_modules/@storybook/components/dist/index.js
@ ./node_modules/@storybook/addon-info/dist/components/markdown/code.js
@ ./node_modules/@storybook/addon-info/dist/components/markdown/index.js
@ ./node_modules/@storybook/addon-info/dist/index.js
@ ./.storybook/config.js
@ ./storybooks/upstart/config.js
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./storybooks/upstart/config.js (webpack)-hot-middleware/client.js?reload=true
ERROR in ./node_modules/@storybook/components/dist/tooltip/WithTooltip.js
Module not found: Error: Can't resolve 'recompose' in '/Users/briengivens/upstart/upstart_web/client/node_modules/@storybook/components/dist/tooltip'
@ ./node_modules/@storybook/components/dist/tooltip/WithTooltip.js 42:17-37
@ ./node_modules/@storybook/components/dist/index.js
@ ./node_modules/@storybook/addon-info/dist/components/markdown/code.js
@ ./node_modules/@storybook/addon-info/dist/components/markdown/index.js
@ ./node_modules/@storybook/addon-info/dist/index.js
@ ./.storybook/config.js
@ ./storybooks/upstart/config.js
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./storybooks/upstart/config.js (webpack)-hot-middleware/client.js?reload=true