I am trying to install MDX in my Gatsby project with all its corresponding dependencies by typing the following command (from official Gatsby docs):
npm install gatsby-plugin-mdx @mdx-js/mdx@v1 @mdx-js/react@v1
The error below shows what happens next.
Ok, this error seems to be happening to more people and I found an answer that partly solves the issue. Typing npm install --save gatsby-plugin-mdx @mdx-js/mdx@v1 @mdx-js/react@v1 --legacy-peer-deps
will result in the packages actually being installed, however, whenever typing npm i
next, I get a similar error:
In other words, the problem remains. Does anyone know what I am doing wrong and how to solve this issue?
CodePudding user response:
Have you tried installing them peer dependencies flag raised?
npm install gatsby-plugin-mdx @mdx-js/mdx@v1 @mdx-js/react@v1 --legacy-peer-deps
CodePudding user response:
I finally found an answer to my problem. It turned out that MDX does not support React 18. After downgrading to React 17 all problems were solved.