docz: ERR_REQUIRE_ESM error on start
Bug Report
yarn add -D docz react react-dom
yarn docz dev
/Users/dangreen/github/react-chartjs-2/node_modules/gatsby-recipes/dist/graphql-server/server.js:52
var remarkMdx = require('remark-mdx');
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/dangreen/github/react-chartjs-2/node_modules/gatsby-recipes/node_modules/remark-mdx/index.js from /Users/dangreen/github/react-chartjs-2/node_modules/gatsby-recipes/dist/graphql-server/server.js not supported.
Instead change the require of index.js in /Users/dangreen/github/react-chartjs-2/node_modules/gatsby-recipes/dist/graphql-server/server.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/Users/dangreen/github/react-chartjs-2/node_modules/gatsby-recipes/dist/graphql-server/server.js:52:17) {
code: 'ERR_REQUIRE_ESM'
}
Environment
- docz version: 2.3.1
- OS: macOS 11.6
- Node/npm version: Node 16, yarn 1
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 19
- Comments: 21 (1 by maintainers)
Commits related to this issue
- Resolutions didn't work, seems unfixed in docz https://github.com/doczjs/docz/issues/1674 — committed to Friends-of-Foxley-Kenley-England/new-fof-website by eloisetaylor5693 2 years ago
If you’re using
npm
(where"resolutions"
is not available), you can install this version ofremark-mdx
to bypass this issue:I think “remark-mdx” is the problem. It work on my computer with yarn. I dont tested with npm.
Env specs: node: 14.17.6 yarn: 1.22.0 npm: 6.14.15
+1
This is happening mainly because all new packages related to Unified are ESM. The new version I’m creating right now fixes this issue 😃
Any updates on when this version will be released @pedronauck ? This library is currently unusable for modern toolchains - unfortunately have to go back to storybook
+1
Thanks for responding! However, an issue such as this having been open since October kind of makes me hesitant to continue my evaluation of docz at this point.
+1
Any updates? The above solutions doesn’t work for me.
Env specs: docz: 2.3.1 node: 16.13.1 yarn: 1.22.17 npm: 8.1.2
@ShrijanaCodes – unfortunately no. I fought with this one for several hours and gave up.