NPM依赖项冲突

wn9m85ua  于 2023-02-16  发布在  其他
关注(0)|答案(2)|浏览(357)

在安装了node.js的新版本之后(从节点14移动到节点18),每次我想在旧的项目中安装一些东西时,这个错误列表就会弹出。我不太明白它与什么有关,以及如何解决下面的冲突。

npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @vue/compiler-sfc@3.1.5
npm WARN Found: vue@3.2.19
npm WARN node_modules/vue
npm WARN   vue@"^3.1.5" from the root project
npm WARN   12 more (@vue/babel-preset-app, @vue/server-renderer, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer vue@"3.1.5" from @vue/compiler-sfc@3.1.5
npm WARN node_modules/@vue/compiler-sfc
npm WARN   dev @vue/compiler-sfc@"^3.0.0" from the root project
npm WARN   1 more (@vue/cli-service)
npm WARN
npm WARN Conflicting peer dependency: vue@3.1.5
npm WARN node_modules/vue
npm WARN   peer vue@"3.1.5" from @vue/compiler-sfc@3.1.5
npm WARN   node_modules/@vue/compiler-sfc
npm WARN     dev @vue/compiler-sfc@"^3.0.0" from the root project
npm WARN     1 more (@vue/cli-service)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @vue/composition-api@0.3.4
npm WARN Found: vue@3.2.19
npm WARN node_modules/vue
npm WARN   vue@"^3.1.5" from the root project
npm WARN   12 more (@vue/babel-preset-app, @vue/server-renderer, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer vue@"^2.5.22" from @vue/composition-api@0.3.4
npm WARN node_modules/@vue/composition-api
npm WARN   peer @vue/composition-api@"^0.3.2" from vue-use-web@1.0.1
npm WARN   node_modules/vue-use-web
npm WARN
npm WARN Conflicting peer dependency: vue@2.7.14
npm WARN node_modules/vue
npm WARN   peer vue@"^2.5.22" from @vue/composition-api@0.3.4
npm WARN   node_modules/@vue/composition-api
npm WARN     peer @vue/composition-api@"^0.3.2" from vue-use-web@1.0.1
npm WARN     node_modules/vue-use-web
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @vueup/vue-quill@1.0.0-beta.8
npm WARN Found: vue@3.2.19
npm WARN node_modules/vue
npm WARN   vue@"^3.1.5" from the root project
npm WARN   12 more (@vue/babel-preset-app, @vue/server-renderer, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer vue@"^3.2.31" from @vueup/vue-quill@1.0.0-beta.8
npm WARN node_modules/@vueup/vue-quill
npm WARN   @vueup/vue-quill@"^1.0.0-beta.8" from the root project
npm WARN
npm WARN Conflicting peer dependency: vue@3.2.47
npm WARN node_modules/vue
npm WARN   peer vue@"^3.2.31" from @vueup/vue-quill@1.0.0-beta.8
npm WARN   node_modules/@vueup/vue-quill
npm WARN     @vueup/vue-quill@"^1.0.0-beta.8" from the root project
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: primevue@3.12.5
npm WARN Found: primeicons@4.1.0
npm WARN node_modules/primeicons
npm WARN   primeicons@"^4.1.0" from the root project
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer primeicons@"^5.0.0" from primevue@3.12.5
npm WARN node_modules/primevue
npm WARN   primevue@"^3.12.5" from the root project
npm WARN
npm WARN Conflicting peer dependency: primeicons@5.0.0
npm WARN node_modules/primeicons
npm WARN   peer primeicons@"^5.0.0" from primevue@3.12.5
npm WARN   node_modules/primevue
npm WARN     primevue@"^3.12.5" from the root project
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: sass-loader@12.1.0
npm WARN Found: webpack@4.46.0
npm WARN node_modules/webpack
npm WARN   peer webpack@"^4.0.0" from @intervolga/optimize-cssnano-plugin@1.0.6
npm WARN   node_modules/@intervolga/optimize-cssnano-plugin
npm WARN     @intervolga/optimize-cssnano-plugin@"^1.0.5" from @vue/cli-service@4.5.13
npm WARN     node_modules/@vue/cli-service
npm WARN   19 more (@soda/friendly-errors-webpack-plugin, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer webpack@"^5.0.0" from sass-loader@12.1.0
npm WARN node_modules/sass-loader
npm WARN   sass-loader@"^12.1.0" from the root project
npm WARN
npm WARN Conflicting peer dependency: webpack@5.75.0
npm WARN node_modules/webpack
npm WARN   peer webpack@"^5.0.0" from sass-loader@12.1.0
npm WARN   node_modules/sass-loader
npm WARN     sass-loader@"^12.1.0" from the root project
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: vue-clickaway@2.2.2
npm WARN Found: vue@3.2.19
npm WARN node_modules/vue
npm WARN   vue@"^3.1.5" from the root project
npm WARN   12 more (@vue/babel-preset-app, @vue/server-renderer, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer vue@"^2.0.0" from vue-clickaway@2.2.2
npm WARN node_modules/vue-clickaway
npm WARN   vue-clickaway@"^2.2.2" from vue-context@6.0.0
npm WARN   node_modules/vue-context
npm WARN
npm WARN Conflicting peer dependency: vue@2.7.14
npm WARN node_modules/vue
npm WARN   peer vue@"^2.0.0" from vue-clickaway@2.2.2
npm WARN   node_modules/vue-clickaway
npm WARN     vue-clickaway@"^2.2.2" from vue-context@6.0.0
npm WARN     node_modules/vue-context
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: vue-demi@0.11.4
npm WARN Found: @vue/composition-api@0.3.4
npm WARN node_modules/@vue/composition-api
npm WARN   peer @vue/composition-api@"^0.3.2" from vue-use-web@1.0.1
npm WARN   node_modules/vue-use-web
npm WARN     vue-use-web@"^1.0.1" from the root project
npm WARN
npm WARN Could not resolve dependency:
npm WARN peerOptional @vue/composition-api@"^1.0.0-rc.1" from vue-demi@0.11.4
npm WARN node_modules/vue-demi
npm WARN   vue-demi@"*" from @vueuse/core@5.3.0
npm WARN   node_modules/@vueuse/core
npm WARN   2 more (@vueuse/integrations, @vueuse/shared)
npm WARN
npm WARN Conflicting peer dependency: @vue/composition-api@1.7.1
npm WARN node_modules/@vue/composition-api
npm WARN   peerOptional @vue/composition-api@"^1.0.0-rc.1" from vue-demi@0.11.4
npm WARN   node_modules/vue-demi
npm WARN     vue-demi@"*" from @vueuse/core@5.3.0
npm WARN     node_modules/@vueuse/core
npm WARN     2 more (@vueuse/integrations, @vueuse/shared)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: vue-js-modal@2.0.1
npm WARN Found: vue@3.2.19
npm WARN node_modules/vue
npm WARN   vue@"^3.1.5" from the root project
npm WARN   12 more (@vue/babel-preset-app, @vue/server-renderer, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer vue@"^2.6.11" from vue-js-modal@2.0.1
npm WARN node_modules/vue-js-modal
npm WARN   vue-js-modal@"^2.0.1" from the root project
npm WARN
npm WARN Conflicting peer dependency: vue@2.7.14
npm WARN node_modules/vue
npm WARN   peer vue@"^2.6.11" from vue-js-modal@2.0.1
npm WARN   node_modules/vue-js-modal
npm WARN     vue-js-modal@"^2.0.1" from the root project

据我所知,我安装的大多数模块都会弹出一个版本相关的错误,在节点14版本上一切正常。

nqwrtyyt

nqwrtyyt1#

这些警告指示项目中安装的不同版本的包之间存在冲突。如果一个包与另一个包的特定版本具有对等依赖关系,但项目中已安装了该包的其他版本,则会发生这些冲突。
要解决这些冲突,您可以尝试更新或降级冲突包的版本,或者直接在项目中安装缺少的对等依赖项。您还可以尝试删除node_modules文件夹并运行npm install以从头开始安装所有包。

vd2z7a6w

vd2z7a6w2#

节点14.. 使用npm 6.. 版本
节点18.. 使用npm 8.. 版本
https://nodejs.org/en/download/releases/
解析dependdenies的工作方式不同。你可以在npm配置页面找到更多信息:https://docs.npmjs.com/cli/v7/using-npm/config
或者使用标记legacy-peer-deps,但不推荐使用,因为它不会强制元依赖关系可能依赖的peerDependencies契约

相关问题