PaulieScanlon / mdx-embed

Embed 3rd party media content in MDX - no import required 🧽
https://mdx-embed.netlify.app/
MIT License
271 stars 30 forks source link

mdx-embed: You must install peer dependencies yourself for react@17.x.x #210

Closed sgmheyhey closed 3 years ago

sgmheyhey commented 3 years ago

Describe the bug

npm WARN mdx-embed@0.0.14 requires a peer of react@^16.13.1 but none is installed. You must install peer dependencies yourself.
npm WARN mdx-embed@0.0.14 requires a peer of react-dom@^16.13.1 but none is installed. You must install peer dependencies yourself.

with react@17.x.x, the messages are produced. it seems working but the messages should be cleared.

PaulieScanlon commented 3 years ago

Is the problem here that you needed to install React? React is a peer dependancy. Could you elaborate a bit and I’d be happy to investigate

sgmheyhey commented 3 years ago

EDIT:

  "dependencies": {
    "@emotion/react": "latest",
    "@emotion/styled": "latest",
    "@mdx-js/loader": "latest",
    "@mdx-js/mdx": "latest",
    "@mdx-js/react": "latest",
    "@next/mdx": "latest",
    "lodash": "latest",
    "mdx-embed": "latest",
    "next": "latest",
    "prism-react-renderer": "latest",
    "react": "latest",
    "react-dom": "latest",
    "react-live": "latest",
    "remark-emoji": "latest",
    "remark-images": "latest",
    "styled-components": "latest",
    "unified-ui": "latest"
  },
 "devDependencies": {
    "@emotion/babel-plugin": "latest",
    "babel-eslint": "latest",
    "eslint": "latest",
    "eslint-config-babel": "latest",
    "eslint-config-google": "latest",
    "eslint-config-prettier": "latest",
    "eslint-plugin-import": "latest",
    "eslint-plugin-prettier": "latest",
    "eslint-plugin-react": "latest",
    "eslint-plugin-standard": "latest",
    "prettier": "latest"
  },

The whole of my package.json file was like the above. I missed some in the previous comment by my mistake.

I guess that it is not matching some peers in the newest packages.

PaulieScanlon commented 3 years ago

Hi @sgmheyhey i still don't really understand the problem. If you've installed the peer dependancies you should be fine. Is your Next project setup to use MDX, i don't see @next/mdx in your deps.

I'll close this issue but feel free to open one again if you're still having problems.

sgmheyhey commented 3 years ago

Sorry, I've just edited the above comment.

PaulieScanlon commented 3 years ago

@sgmheyhey could you maybe try installing the peer deps as version numbers: Here's what MDX Embed wants as peerDependencies

  "peerDependencies": {
    "@mdx-js/mdx": "^1.6.16",
    "@mdx-js/react": "^1.6.16",
    "react": "^16.13.1",
    "react-dom": "^16.13.1"
  }
sgmheyhey commented 3 years ago

They're gone! Thank you!

PaulieScanlon commented 3 years ago

Ok great!

I think the problem was MDX Embed has a peer dependancy of "react: ^16.x.x" and you had installed "react: latest" which would have installed "react 17.x.x"

The difference between "16.x.x." and "17.x.x" with regard to semver is "breaking" so i think there's probably something in "react 17.x.x." that doesn't work with MDX Embed...

...but that's ok. MDX Embed does specify that it's "react: 16.x.x" you need to install not "react: latest" or "react: 17.x.x."

danielmarinq commented 3 years ago

@PaulieScanlon is there any plan to support react 17 in the future?