我在 React 上使用 PlateJS
我想安装一个新组件,所以我使用与安装其他组件相同的命令安装了它(@udecode/plate-ui@latest add [platejs 组件名称)我想要
图像元素组件,所以我做了npx @udecode/plate-ui@latest add image-element
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: [email protected]
npm ERR! Found: @udecode/[email protected]
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/[email protected]
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.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! C:\Users\maxen\AppData\Local\npm-cache\_logs\2024-04-10T17_22_50_842Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in: C:\Users\maxen\AppData\Local\npm-cache\_logs\2024-04-10T17_22_50_842Z-debug-0.log
我的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"
}
正如这里提到的Could not resolve dependency:
peer @udecode/plate-common@">=31.0.0"
我的 package.json 中的 npm 上的最新版本 然后我做了
npm update --save
,
npm install
,但是我遇到了很多错误,因为所有其他组件都是使用 udecode/plate-common ^30.4.5 安装的,并且依赖于这个版本查看错误 和
npm install
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: @udecode/[email protected]
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/[email protected]
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: [email protected]
npm WARN Found: @udecode/[email protected]
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/[email protected]
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: [email protected]
npm WARN Found: @udecode/[email protected]
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/[email protected]
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: [email protected]
npm WARN Found: @udecode/[email protected]
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/[email protected]
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: [email protected]
npm WARN Found: @udecode/[email protected]
npm WARN Could not resolve dependency:
npm WARN peer @udecode/plate-common@">=30.4.5 < 31" from @udecode/[email protected]
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: [email protected]
npm WARN Found: @udecode/[email protected]
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/[email protected]
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: [email protected]
npm WARN Found: @udecode/[email protected]
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/[email protected]
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: [email protected]
npm WARN Found: @udecode/[email protected]
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/[email protected]
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: [email protected]
npm WARN Found: @udecode/[email protected]
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/[email protected]
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: [email protected]
npm WARN Found: @udecode/[email protected]
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/[email protected]
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: [email protected]
npm WARN Found: @udecode/[email protected]
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/[email protected]
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: [email protected]
npm ERR! Found: @udecode/[email protected]
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/[email protected]
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
npm ERR! A complete log of this run can be found in: C:\Users\maxen\AppData\Local\npm-cache\_logs\2024-04-10T17_35_46_285Z-debug-0.log