无法在nextjs应用程序中正常解决依赖关系

nx7onnlm  于 2022-10-12  发布在  Node.js
关注(0)|答案(1)|浏览(136)

我正在尝试部署我的next.js项目,但我所做的每一件事都不断收到以下错误:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: rcd_drone@0.1.0
npm ERR! Found: @sanity/client@3.4.1
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! 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.

我还有以下依赖项:

{
  "name": "rcd_drone",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@babel/core": "^7.17.9",
    "@sanity/client": "^3.2.0",
    "@sanity/image-url": "^1.0.1",
    "@stripe/stripe-js": "^1.25.0",
    "canvas-confetti": "^1.5.1",
    "next": "^12.1.0",
    "next-sanity-image": "^3.2.1",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-hot-toast": "^2.2.0",
    "react-icons": "^4.3.1",
    "frontmatter-markdown-loader": "^3.6.3",
    "stripe": "^8.209.0"
  },
  "devDependencies": {
    "@babel/preset-react": "^7.16.7",
    "eslint": "8.13.0",
    "eslint-config-next": "12.1.4"
  }
}
xdnvmnnf

xdnvmnnf1#

尝试删除node_modules文件夹和package-lock.json文件,然后运行:

npm install --legacy-peer-deps

这将使模块重新安装。

相关问题