By cross-env NODE_PATH=\"src\" build-storybook -c .storybook -o docs
taking an error:
TypeError: Cannot read properties of null (reading 'babel')
ERR! at _callee$ (node_modules\@storybook\react\node_modules\@storybook\telemetry\dist\cjs\storybook-metadata.js:194:52)
ERR! at tryCatch (node_modules\regenerator-runtime\runtime.js:63:40)
ERR! at Generator.invoke [as _invoke] (node_modules\regenerator-runtime\runtime.js:294:22)
ERR! at Generator.throw (node_modules\regenerator-runtime\runtime.js:119:21)
ERR! at asyncGeneratorStep (node_modules\@storybook\react\node_modules\@storybook\telemetry\dist\cjs\storybook-metadata.js:66:103)
ERR! at _throw (node_modules\@storybook\react\node_modules\@storybook\telemetry\dist\cjs\storybook-metadata.js:68:291)
ERR! at processTicksAndRejections (node:internal/process/task_queues:96:5)
While usage of cross-env NODE_PATH=\"src\" start-storybook
generates StoryBook fine.
Any ideas how to resolve? Thanks in advance
// .storybook/config.jsx
module.exports = {
stories: ['../src/**/*.stories.tsx'],
babel: async options => ({
...options,
presets: [['@babel/preset-react', {runtime: 'automatic'}]]
})
};
I was able to fix this by doing one of:
main.js
@storybook/telemetry
, from which the error comes from.The error comes from this line in Storybook's code, where I'm guessing mainConfig
is null
as there is no main.js
. The code originates from the PR that added telemetry in 6.5.0-beta.2
(note that v6.5 was the last minor version of v6 before v7). So if I had to guess, seems like a bug in v6.5.x Storybook versions.
For reference, I had the same error without even a Babel config and with a custom webpack.config.js
with no Babel config. Same that start-storybook
works while build-storybook
fails with this error.