[gatsby-plugin-mdx] cannot find module
See original GitHub issueDescription
I’m trying to add a custom plugin to gatsby-plugin-mdx
. I’ve made sure:
- It is located in
/plugins/gatsby-remark-normalize-url
- It has a
package.json
file andindex.js
- It is added into
gatsby-config.js
{
"name": "gatsby-remark-normalize-url",
"description": "Normalize URL's with sindresorhus popular normalize-url lib",
"version": "1.0.0",
"dependencies": {
"normalize-url": "^5.0.0",
"unist-util-visit": "^2.0.2"
}
}
const gatsbyPluginMdx = {
resolve: `gatsby-plugin-mdx`,
options: {
gatsbyRemarkPlugins: [
`gatsby-remark-normalize-url`,
],
}
}
Steps to reproduce
My project: https://github.com/muuvmuuv/portfolio (changes not included but can be added)
- add a plugin described above into
plugins
(it shouldn’t do anything) - run
gatsby develop
Expected result
What should happen?
Actual result
ERROR #11321 PLUGIN
"gatsby-plugin-mdx" threw an error while running the onCreateNode lifecycle:
Cannot find module 'gatsby-remark-normalize-url'
Require stack:
- /Users/marvinheilemann/Development/Portfolio/node_modules/.pnpm/registry.npmjs.org/gatsby-plugin-mdx/1.0.75_48af87626be11f1a2f9cb7c62b6c17dc/node_modules/gatsby-plugin-mdx/utils/get-source-plugins-as-remark-plugins.js
- /Users/marvinheilemann/Development/Portfolio/node_modules/.pnpm/registry.npmjs.org/gatsby-plugin-mdx/1.0.75_48af87626be11f1a2f9cb7c62b6c17dc/node_modules/gatsby-plugin-mdx/utils/gen-mdx.js
- /Users/marvinheilemann/Development/Portfolio/node_modules/.pnpm/registry.npmjs.org/gatsby-plugin-mdx/1.0.75_48af87626be11f1a2f9cb7c62b6c17dc/node_modules/gatsby-plugin-mdx/gatsby/source-nodes.js
- /Users/marvinheilemann/Development/Portfolio/node_modules/.pnpm/registry.npmjs.org/gatsby-plugin-mdx/1.0.75_48af87626be11f1a2f9cb7c62b6c17dc/node_modules/gatsby-plugin-mdx/gatsby-node.js
- /Users/marvinheilemann/Development/Portfolio/node_modules/.pnpm/registry.npmjs.org/gatsby/2.19.28_1b55037e18e5731ef1b673b5516aa9fb/node_modules/gatsby/dist/bootstrap/resolve-module-exports.js
- /Users/marvinheilemann/Development/Portfolio/node_modules/.pnpm/registry.npmjs.org/gatsby/2.19.28_1b55037e18e5731ef1b673b5516aa9fb/node_modules/gatsby/dist/bootstrap/load-plugins/validate.js
- /Users/marvinheilemann/Development/Portfolio/node_modules/.pnpm/registry.npmjs.org/gatsby/2.19.28_1b55037e18e5731ef1b673b5516aa9fb/node_modules/gatsby/dist/bootstrap/load-plugins/load.js
- /Users/marvinheilemann/Development/Portfolio/node_modules/.pnpm/registry.npmjs.org/gatsby/2.19.28_1b55037e18e5731ef1b673b5516aa9fb/node_modules/gatsby/dist/bootstrap/load-plugins/index.js
- /Users/marvinheilemann/Development/Portfolio/node_modules/.pnpm/registry.npmjs.org/gatsby/2.19.28_1b55037e18e5731ef1b673b5516aa9fb/node_modules/gatsby/dist/bootstrap/index.js
- /Users/marvinheilemann/Development/Portfolio/node_modules/.pnpm/registry.npmjs.org/gatsby/2.19.28_1b55037e18e5731ef1b673b5516aa9fb/node_modules/gatsby/dist/commands/develop.js
- /Users/marvinheilemann/Development/Portfolio/node_modules/.pnpm/registry.npmjs.org/gatsby-cli/2.10.0/node_modules/gatsby-cli/lib/create-cli.js
- /Users/marvinheilemann/Development/Portfolio/node_modules/.pnpm/registry.npmjs.org/gatsby-cli/2.10.0/node_modules/gatsby-cli/lib/index.js
- /Users/marvinheilemann/Development/Portfolio/node_modules/.pnpm/registry.npmjs.org/gatsby/2.19.28_1b55037e18e5731ef1b673b5516aa9fb/node_modules/gatsby/dist/bin/gatsby.js
Environment
System:
OS: macOS 10.15.3
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.16.1 - ~/.nvm/versions/node/v12.16.1/bin/node
Yarn: 1.22.0 - /usr/local/bin/yarn
npm: 6.13.4 - ~/.nvm/versions/node/v12.16.1/bin/npm
Languages:
Python: 2.7.16 - /usr/bin/python
Browsers:
Firefox: 73.0.1
Safari: 13.0.5
npmPackages:
gatsby: ^2.19.28 => 2.19.28
gatsby-image: ^2.2.42 => 2.2.42
gatsby-plugin-breadcrumb: ^9.0.1 => 9.0.1
gatsby-plugin-canonical-urls: ^2.1.20 => 2.1.20
gatsby-plugin-catch-links: ^2.1.26 => 2.1.26
gatsby-plugin-humans-txt: ^1.1.4 => 1.1.4
gatsby-plugin-layout: ^1.1.22 => 1.1.22
gatsby-plugin-manifest: ^2.2.42 => 2.2.42
gatsby-plugin-mdx: ^1.0.75 => 1.0.75
gatsby-plugin-offline: ^3.0.35 => 3.0.35
gatsby-plugin-pnpm: ^1.2.3 => 1.2.3
gatsby-plugin-postcss: ^2.1.20 => 2.1.20
gatsby-plugin-preact: ^3.1.26 => 3.1.26
gatsby-plugin-react-axe: ^0.4.0 => 0.4.0
gatsby-plugin-react-helmet-async: ^1.0.15 => 1.0.15
gatsby-plugin-react-svg: ^3.0.0 => 3.0.0
gatsby-plugin-remove-generator: ^1.0.4 => 1.0.4
gatsby-plugin-remove-trailing-slashes: ^2.1.21 => 2.1.21
gatsby-plugin-robots-txt: ^1.5.0 => 1.5.0
gatsby-plugin-sass: ^2.1.29 => 2.1.29
gatsby-plugin-sharp: ^2.4.5 => 2.4.5
gatsby-plugin-simple-analytics: ^1.0.3 => 1.0.3
gatsby-plugin-sitemap: ^2.2.27 => 2.2.27
gatsby-plugin-webpack-bundle-analyzer: ^1.0.5 => 1.0.5
gatsby-remark-autolink-headers: ^2.1.24 => 2.1.24
gatsby-remark-check-links: ^2.1.0 => 2.1.0
gatsby-remark-copy-linked-files: ^2.1.37 => 2.1.37
gatsby-remark-embedder: ^1.12.0 => 1.12.0
gatsby-remark-images: ^3.1.44 => 3.1.44
gatsby-source-filesystem: ^2.1.48 => 2.1.48
gatsby-source-graphql: 2.1.33 => 2.1.33
gatsby-transformer-json: ^2.2.26 => 2.2.26
gatsby-transformer-leasot: ^1.2.2 => 1.2.2
gatsby-transformer-sharp: ^2.3.16 => 2.3.16
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:9 (4 by maintainers)
Top Results From Across the Web
gatsby-plugin-mdx cannot find module 'gatsby/webpack'
It's difficult to spot without seeing the site live but I guess that the underlying issue is the gatsby-plugin-mdx version ( ^3.3.0 )....
Read more >gatsby-plugin-mdx - npm
Start using gatsby-plugin-mdx in your project by running `npm i ... You can find that information in their respective README. module.exports ...
Read more >Troubleshooting Common Errors - Gatsby
Build problems from Field 'browser' doesn't contain a valid alias configuration. If you are seeing an error like: Copycopy code to clipboard. Module...
Read more >Build Deploys Fail - Can't Find module after many ...
... 2:11:14 PM: $ gatsby build 2:11:17 PM: error Error in "/opt/build/repo/node_modules/gatsby-plugin-mdx/gatsby-node.js": Cannot find module '@mdx-js/mdx' ...
Read more >MDX 2 Breaking changes and gatsby-plugin-mdx v4 (Content)
If you've gone ahead and upgraded the plugin to v4 and started your development server, you'll probably see an error like this. 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
I assume it is pnpm related which I am also running into. Would be great to have the standard gatsby resolve doing the work. Though I have some slightly different issue. I have some base package sharing some code and dependencies, but at the moment I have to add
to every child package to make the mdx rendering work, even though these packages should be taken from the baselib.
This however works: