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?

