【问题标题】:Upstream dependency conflict, npm sanity/client上游依赖冲突,npm sanity/client
【发布时间】:2022-09-27 21:50:07
【问题描述】:

我目前正在尝试制作一个 nextjs/sanity 项目,我想我可能已经安装了两次 sanity 客户端,但并不完全确定。

这是我在命令终端中遇到的错误:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: next-sanity-image@3.2.1
npm ERR! Found: @sanity/client@3.3.6
npm ERR! node_modules/@sanity/client
npm ERR!   @sanity/client@\"^3.2.0\" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @sanity/client@\"^2.11.0\" from next-sanity-image@3.2.1
npm ERR! node_modules/next-sanity-image
npm ERR!   next-sanity-image@\"^3.2.1\" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @sanity/client@2.23.2
npm ERR! node_modules/@sanity/client
npm ERR!   peer @sanity/client@\"^2.11.0\" from next-sanity-image@3.2.1
npm ERR!   node_modules/next-sanity-image
npm ERR!     next-sanity-image@\"^3.2.1\" 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 install --legacy-peer-deps 但它没有解决这个错误。我目前正在尝试执行npm install --save @babel/preset-react,这就是触发这些错误消息的原因。我需要做什么?

  • 删除节点模块,删除 package-lock.json 并再次运行 npm i

标签: reactjs npm next.js sanity


【解决方案1】:

我认为您的理智客户端已被弃用。 尝试删除package.json 中的错误消息列出的所有健全依赖项(@sanity/client@"^3.2.0" / "next-sanity-image": "^3.2.1")。

然后,只需尝试重新安装 Sanity --> npm i sanity

它应该工作!

【讨论】:

    猜你喜欢
    • 2021-12-14
    • 2021-03-04
    • 2023-02-02
    • 1970-01-01
    • 2022-11-14
    • 2022-10-24
    • 2022-08-12
    • 1970-01-01
    • 2011-03-12
    相关资源
    最近更新 更多