@mdx-js/runtime Module not found: Can't resolve '@mdx-js/runtime'
See original GitHub issueSubject of the issue
When using MDX Runtime with NextJS, and using import MDX from @mdx-js/runtime
to use the package the following error is being raised:
NOTE This error occurs after performing a yarn add @mdx-js/runtime
and yarn install
Module not found: Can't resolve '@mdx-js/runtime' in '/User/path/to/project/mdx-runtime-error-nextjs/pages
This appears to be related to the upgrade from 1.5.1
to 1.5.2
as this error was not present in prior versions of @mdx-js/runtime
, such as 1.5.1
.
Version 1.5.2
is present in the web-app that originated this error for us, as shown in the repository below.
Comparison of changes: https://github.com/mdx-js/mdx/compare/v1.5.1...v1.5.2
Your environment
- OS: System Version: macOS 10.14.6 (18G103); Kernel Version: Darwin 18.7.0;
- Packages:
"dependencies": {
"@mdx-js/loader": "^1.5.2",
"@mdx-js/mdx": "^1.5.2",
"@mdx-js/react": "^1.5.2",
"@mdx-js/runtime": "^1.5.2",
"@next/mdx": "^9.0.3",
"next": "^9.0.3",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"remark-emoji": "^2.0.2",
"remark-images": "^1.0.0"
}
- Env:
- Node: v13.2.0
- Yarn: 1.19.2
- Chrome: Version 79.0.3945.79 (Official Build) (64-bit)
Steps to reproduce
Please see the minimum viable error reproduction repository here:
Also see this Code Sandbox with a working example of the error:
Run the steps below to see the error:
yarn install
yarn dev
- Visit
http:localhost:3000
to view the Index page loading correctly. - Visit
http:localhost:3000/hello
to view the Hello page loading correctly. - Visit
http:localhost:3000/runtime
to view the “Module not found” error.
NOTE: @mdx-js is installed within node_modules and includes the /runtime/dist directory.
Expected behaviour
The @mdx-js/runtime
module is imported successfully and available for use as a component for generating dynamic React component output.
Actual behaviour
The runtime raises an error that the module cannot be resolved with the message:
Module not found: Can't resolve '@mdx-js/runtime'
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (5 by maintainers)
Top GitHub Comments
Sorry @Dangeranger , it should be fixed in #877, let’s wait a new patch version.
@ChristianMurphy You can see the fixed and working version at the following URLs.