udecode / plate

A rich-text editor powered by AI
https://platejs.org
Other
12.01k stars 734 forks source link

"Could not resolve dependency" when installing a new component #3116

Closed Maxx59 closed 7 months ago

Maxx59 commented 7 months ago

Description

Steps to Reproduce

I wanted to install a new component, so I installed it with the same command used to install the other components (@udecode/plate-ui@latest add [platejs component name)

I wanted the image element component, so I did npx @udecode/plate-ui@latest add image-element

But it didn't work as usual, I got this error:

see image here

npx @udecode/plate-ui@latest add image-element
⠸ Installing image-element...Command failed with exit code 1: npm install @udecode/plate-media
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: portfolio-react@0.0.0
npm ERR! Found: @udecode/plate-common@30.4.5
npm ERR! node_modules/@udecode/plate-common
npm ERR!   @udecode/plate-common@"^30.4.5" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @udecode/plate-common@">=31.0.0" from @udecode/plate-media@31.0.0
npm ERR! node_modules/@udecode/plate-media
npm ERR!   @udecode/plate-media@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

My package.json :

"dependencies": {
    "@headlessui/react": "^1.7.18",
    "@heroicons/react": "^2.1.1",
    "@radix-ui/react-accordion": "^1.1.2",
    "@radix-ui/react-avatar": "^1.0.4",
    "@radix-ui/react-dropdown-menu": "^2.0.6",
    "@radix-ui/react-icons": "^1.3.0",
    "@radix-ui/react-popover": "^1.0.7",
    "@radix-ui/react-separator": "^1.0.3",
    "@radix-ui/react-slot": "^1.0.2",
    "@radix-ui/react-toolbar": "^1.0.4",
    "@radix-ui/react-tooltip": "^1.0.7",
    "@slate-editor/alignment-plugin": "^5.1.0",
    "@udecode/cn": "^29.0.1",
    "@udecode/plate": "^30.9.3",
    "@udecode/plate-alignment": "^30.5.3",
    "@udecode/plate-basic-elements": "^30.7.0",
    "@udecode/plate-basic-marks": "^30.5.3",
    "@udecode/plate-block-quote": "^30.5.3",
    "@udecode/plate-combobox": "^30.5.3",
    "@udecode/plate-comments": "^30.5.3",
    "@udecode/plate-common": "^30.4.5",
    "@udecode/plate-cursor": "^30.5.3",
    "@udecode/plate-dnd": "^30.5.3",
    "@udecode/plate-floating": "^30.5.3",
    "@udecode/plate-heading": "^30.5.3",
    "@udecode/plate-line-height": "^30.5.3",
    "@udecode/plate-mention": "^30.5.3",
    "@udecode/plate-paragraph": "^30.5.3",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.1.0",
    "date-fns": "^3.5.0",
    "embla-carousel-react": "^8.0.0",
    "i18next": "^23.10.1",
    "i18next-http-backend": "^2.5.0",
    "lucide-react": "^0.344.0",
    "react": "^18.2.0",
    "react-dnd": "^16.0.1",
    "react-dnd-html5-backend": "^16.0.1",
    "react-dom": "^18.2.0",
    "react-i18next": "^14.1.0",
    "react-router-dom": "^6.22.2",
    "react-router-hash-link": "^2.4.3",
    "slate": "^0.102.0",
    "slate-history": "^0.100.0",
    "slate-hyperscript": "^0.100.0",
    "slate-react": "^0.102.0",
    "tailwind-merge": "^2.2.1",
    "tailwindcss-animate": "^1.0.7",
    "tw-colors": "^3.3.1",
    "vite-plugin-svgr": "^4.2.0"
  }

As mentioned here

Could not resolve dependency:
peer @udecode/plate-common@">=31.0.0"

I changed "@udecode/plate-common": "^30.4.5" to "@udecode/plate-common": "^31.3.2" the latest version on npm in my package.json

Then I did npm update --save, npm install, but I get lots of errors because all the other components were installed with udecode/plate-common ^30.4.5 and depend on this version

img1 img2

npm install
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: portfolio-react@0.0.0
npm WARN Found: @udecode/plate-common@30.4.5
npm WARN node_modules/@udecode/plate-common
npm WARN   @udecode/plate-common@"^31.3.2" from the root project
npm WARN   42 more (@udecode/plate, @udecode/plate-alignment, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer @udecode/plate-common@">=30.4.5 < 31" from @udecode/plate-alignment@30.5.3
npm WARN node_modules/@udecode/plate-alignment
npm WARN   @udecode/plate-alignment@"^30.5.3" from the root project
npm WARN   1 more (@udecode/plate)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: portfolio-react@0.0.0
npm WARN Found: @udecode/plate-common@30.4.5
npm WARN node_modules/@udecode/plate-common
npm WARN   @udecode/plate-common@"^31.3.2" from the root project
npm WARN   42 more (@udecode/plate, @udecode/plate-alignment, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer @udecode/plate-common@">=30.4.5 < 31" from @udecode/plate-basic-elements@30.7.0
npm WARN node_modules/@udecode/plate-basic-elements
npm WARN   @udecode/plate-basic-elements@"^30.7.0" from the root project
npm WARN   1 more (@udecode/plate)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: portfolio-react@0.0.0
npm WARN Found: @udecode/plate-common@30.4.5
npm WARN node_modules/@udecode/plate-common
npm WARN   @udecode/plate-common@"^31.3.2" from the root project
npm WARN   42 more (@udecode/plate, @udecode/plate-alignment, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer @udecode/plate-common@">=30.4.5 < 31" from @udecode/plate-basic-marks@30.5.3
npm WARN node_modules/@udecode/plate-basic-marks
npm WARN   @udecode/plate-basic-marks@"^30.5.3" from the root project
npm WARN   2 more (@udecode/plate, @udecode/plate-serializer-md)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: portfolio-react@0.0.0
npm WARN Found: @udecode/plate-common@30.4.5
npm WARN node_modules/@udecode/plate-common
npm WARN   @udecode/plate-common@"^31.3.2" from the root project
npm WARN   42 more (@udecode/plate, @udecode/plate-alignment, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer @udecode/plate-common@">=30.4.5 < 31" from @udecode/plate-block-quote@30.5.3
npm WARN node_modules/@udecode/plate-block-quote
npm WARN   @udecode/plate-block-quote@"^30.5.3" from the root project
npm WARN   3 more (@udecode/plate, @udecode/plate-basic-elements, @udecode/plate-serializer-md)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: portfolio-react@0.0.0
npm WARN Found: @udecode/plate-common@30.4.5
npm WARN Could not resolve dependency:
npm WARN peer @udecode/plate-common@">=30.4.5 < 31" from @udecode/plate-cursor@30.5.3
npm WARN node_modules/@udecode/plate-cursor
npm WARN   @udecode/plate-cursor@"^30.5.3" from the root project
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: portfolio-react@0.0.0
npm WARN Found: @udecode/plate-common@30.4.5
npm WARN node_modules/@udecode/plate-common
npm WARN   @udecode/plate-common@"^31.3.2" from the root project
npm WARN   42 more (@udecode/plate, @udecode/plate-alignment, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer @udecode/plate-common@">=30.4.5 < 31" from @udecode/plate-dnd@30.5.3
npm WARN node_modules/@udecode/plate-dnd
npm WARN   @udecode/plate-dnd@"^30.5.3" from the root project
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: portfolio-react@0.0.0
npm WARN Found: @udecode/plate-common@30.4.5
npm WARN node_modules/@udecode/plate-common
npm WARN   @udecode/plate-common@"^31.3.2" from the root project
npm WARN   42 more (@udecode/plate, @udecode/plate-alignment, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer @udecode/plate-common@">=30.4.5 < 31" from @udecode/plate-floating@30.5.3
npm WARN node_modules/@udecode/plate-floating
npm WARN   @udecode/plate-floating@"^30.5.3" from the root project
npm WARN   2 more (@udecode/plate, @udecode/plate-link)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: portfolio-react@0.0.0
npm WARN Found: @udecode/plate-common@30.4.5
npm WARN node_modules/@udecode/plate-common
npm WARN   @udecode/plate-common@"^31.3.2" from the root project
npm WARN   42 more (@udecode/plate, @udecode/plate-alignment, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer @udecode/plate-common@">=30.4.5 < 31" from @udecode/plate-heading@30.5.3
npm WARN node_modules/@udecode/plate-heading
npm WARN   @udecode/plate-heading@"^30.5.3" from the root project
npm WARN   4 more (@udecode/plate, @udecode/plate-basic-elements, ...)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: portfolio-react@0.0.0
npm WARN Found: @udecode/plate-common@30.4.5
npm WARN node_modules/@udecode/plate-common
npm WARN   @udecode/plate-common@"^31.3.2" from the root project
npm WARN   42 more (@udecode/plate, @udecode/plate-alignment, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer @udecode/plate-common@">=30.4.5 < 31" from @udecode/plate-line-height@30.5.3
npm WARN node_modules/@udecode/plate-line-height
npm WARN   @udecode/plate-line-height@"^30.5.3" from the root project
npm WARN   1 more (@udecode/plate)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: portfolio-react@0.0.0
npm WARN Found: @udecode/plate-common@30.4.5
npm WARN node_modules/@udecode/plate-common
npm WARN   @udecode/plate-common@"^31.3.2" from the root project
npm WARN   42 more (@udecode/plate, @udecode/plate-alignment, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer @udecode/plate-common@">=30.4.5 < 31" from @udecode/plate-mention@30.5.3
npm WARN node_modules/@udecode/plate-mention
npm WARN   @udecode/plate-mention@"^30.5.3" from the root project
npm WARN   1 more (@udecode/plate)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: portfolio-react@0.0.0
npm WARN Found: @udecode/plate-common@30.4.5
npm WARN node_modules/@udecode/plate-common
npm WARN   @udecode/plate-common@"^31.3.2" from the root project
npm WARN   42 more (@udecode/plate, @udecode/plate-alignment, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer @udecode/plate-common@">=30.4.5 < 31" from @udecode/plate-paragraph@30.5.3
npm WARN node_modules/@udecode/plate-paragraph
npm WARN   @udecode/plate-paragraph@"^30.5.3" from the root project
npm WARN   4 more (@udecode/plate, @udecode/plate-basic-elements, ...)
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: portfolio-react@0.0.0
npm ERR! Found: @udecode/plate-common@31.3.2
npm ERR! node_modules/@udecode/plate-common
npm ERR!   @udecode/plate-common@"^31.3.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @udecode/plate-common@">=30.4.5 < 31" from @udecode/plate-alignment@30.5.3
npm ERR! node_modules/@udecode/plate-alignment
npm ERR!   @udecode/plate-alignment@"^30.5.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! C:\Users\maxen\AppData\Local\npm-cache\_logs\2024-04-10T17_35_46_285Z-eresolve-report.txt

Sandbox

Expected Behavior

Environment

Bounty

Click here to add a bounty via Algora.

Funding

Fund with Polar

Maxx59 commented 7 months ago

I finally found it, it worked with npm config set legacy-peer-deps true or also npm install --legacy-peer-deps