【发布时间】: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