Module not found: Can’t resolve ‘@mdx-js/react’ Error in mdx-embed [Solution]

Error: While building the app mdx-embed is not able to resolve peer dependencies ‘@mdx-js/react’ inside Node modules

 mdx-embed error solution

Solution

  1. This problem arises mostly after node version updates. To resolve this first you can try to remove node modules` and `package-lock.json` and try to re install packages and rebuild it.
  2. Another solution is to install @mdx-js/react@^1.6.22 as legacy peer dependecy
yarn add  @mdx-js/react@^1.6.22 -D --legacy-peer-deps

After this rebuild it, it should work.

Sharing Is Caring:

A Javascript Nerd