Module build failed (from ./node_modules/@mdx-js/loader/index.js)
See original GitHub issueDescribe the bug Everything worked fine until in and MDX file I’ve added a new story. In other MDX files stories work fine.
The error message is:
Module build failed (from ./node_modules/@mdx-js/loader/index.js):
SyntaxError: Unexpected token (1:62)
at Object.raise (/home/cs/work/react-best-practices/node_modules/@storybook/addon-docs/node_modules/@babel/parser/lib/index.js:6325:17)
at Object.unexpected (/home/cs/work/react-best-practices/node_modules/@storybook/addon-docs/node_modules/@babel/parser/lib/index.js:7642:16)
at Object.getExpression (/home/cs/work/react-best-practices/node_modules/@storybook/addon-docs/node_modules/@babel/parser/lib/index.js:8125:12)
at Object.parseExpression (/home/cs/work/react-best-practices/node_modules/@storybook/addon-docs/node_modules/@babel/parser/lib/index.js:11316:17)
at getExports (/home/cs/work/react-best-practices/node_modules/@storybook/addon-docs/dist/mdx/mdx-compiler-plugin.js:257:26)
at /home/cs/work/react-best-practices/node_modules/@storybook/addon-docs/dist/mdx/mdx-compiler-plugin.js:304:19
at Array.forEach ()
at extractExports (/home/cs/work/react-best-practices/node_modules/@storybook/addon-docs/dist/mdx/mdx-compiler-plugin.js:303:17)
at Compiler (/home/cs/work/react-best-practices/node_modules/@storybook/addon-docs/dist/mdx/mdx-compiler-plugin.js:364:14)
at Function.stringify (/home/cs/work/react-best-practices/node_modules/unified/index.js:344:12)
at pipelineStringify (/home/cs/work/react-best-practices/node_modules/unified/index.js:40:25)
at wrapped (/home/cs/work/react-best-practices/node_modules/trough/wrap.js:25:19)
at next (/home/cs/work/react-best-practices/node_modules/trough/index.js:57:24)
at done (/home/cs/work/react-best-practices/node_modules/trough/wrap.js:55:16)
at done (/home/cs/work/react-best-practices/node_modules/unified/index.js:34:7)
at done (/home/cs/work/react-best-practices/node_modules/unified/index.js:304:11)
./src/components/ThinkingInReact/ThinkingInReact.stories.mdx@http://localhost:9009/main.0bbc0897561a87b9ac64.bundle.js:7044:7
__webpack_require__@http://localhost:9009/runtime~main.0bbc0897561a87b9ac64.bundle.js:786:30
fn@http://localhost:9009/runtime~main.0bbc0897561a87b9ac64.bundle.js:151:20
webpackContext@http://localhost:9009/main.0bbc0897561a87b9ac64.bundle.js:41:9
loadStories/
To Reproduce Steps to reproduce the behavior:
- Go to https://github.com/metamn/react-best-practices/releases/tag/v0.0.2
- Download the release frozen to keep the bug
- Install locally and run storybook
- See error
Expected behavior It should display the new story as the other stories in the past
Screenshots
Code snippets
This is the component: src/components/ThinkingInReact/ThinkingInReact.js
This is the MDX file: src/components/ThinkingInReact/ThinkingInReact.stories.mdx
This is the story:
<Preview>
<Story name="Pure component">
<PureComponent param1="String" param2={true} />
</Story>
</Preview>
System:
Environment Info:
System:
OS: Linux 4.15 Ubuntu 18.04.3 LTS (Bionic Beaver)
CPU: (4) x64 Intel(R) Core(TM) i5-7Y54 CPU @ 1.20GHz
Binaries:
Node: 10.16.3 - /usr/local/bin/node
Yarn: 1.9.4 - /usr/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Browsers:
Chrome: 70.0.3538.77
Firefox: 68.0.2
npmPackages:
@storybook/addon-actions: ^5.2.0-rc.2 => 5.2.0-rc.2
@storybook/addon-docs: ^5.2.0-rc.2 => 5.2.0-rc.2
@storybook/addon-links: ^5.2.0-rc.2 => 5.2.0-rc.2
@storybook/addons: ^5.2.0-rc.2 => 5.2.0-rc.2
@storybook/react: ^5.2.0-rc.2 => 5.2.0-rc.2
@storybook/storybook-deployer: ^2.8.1 => 2.8.1
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:5 (1 by maintainers)
Top Results From Across the Web
16 - Stack Overflow
main.js Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module 'babel-preset-es2015' from ...
Read more >Bug Report - GitHub
Bug Report Current Behavior when i try to run the command npm start i get that error : ERROR in ./main.js Module build...
Read more >Your browser can't play this video. Learn more - YouTube
Module build failed (from ./node_modules/source-map-loader/dist/cjs. js ): Error: ENOENT: no such file or directory, ...
Read more >Get Help and Help Others - RedwoodJS Community
Compiled with problems:X ERROR in ./src/components/Button/Button.tsx Module build failed (from ../node_modules/babel-loader/lib/index.js):.
Read more >Angular - Code with Mosh Forum
src/main.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js): Error: Emit ./src/polyfills.ts - Error: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Do you need to set
configureJsx: true
in the preset?https://github.com/storybookjs/storybook/blob/master/addons/docs/README.md#preset-options
having the same issue here and using nrwl/nx. After applying additional config it fails with following warnings: