1

I have tried to look up and read up about peer dependencies with npm but this error im getting is confusing me enough. Could anyone help me figure what package is causing this problem? I tried to follow everything from the bottom up but im getting lost every time.

Here is the error:

remote: -----> Installing dependencies
remote:        Installing node modules
remote:        npm ERR! code ERESOLVE
remote:        npm ERR! ERESOLVE could not resolve
remote:        npm ERR! 
remote:        npm ERR! While resolving: next-sanity-image@3.2.1
remote:        npm ERR! Found: @sanity/client@3.3.2
remote:        npm ERR! node_modules/@sanity/client
remote:        npm ERR!   @sanity/client@"^3.3.2" from the root project
remote:        npm ERR!   @sanity/client@"^3.2.0" from @sanity/types@2.29.5
remote:        npm ERR!   node_modules/@sanity/types
remote:        npm ERR!     @sanity/types@"^2.0.1" from @sanity/groq-store@0.3.1
remote:        npm ERR!     node_modules/@sanity/groq-store
remote:        npm ERR!       @sanity/groq-store@"^0.3.1" from next-sanity@0.5.2
remote:        npm ERR!       node_modules/next-sanity
remote:        npm ERR!         next-sanity@"^0.5.2" from the root project
remote:        npm ERR!   1 more (next-sanity)
remote:        npm ERR! 
remote:        npm ERR! Could not resolve dependency:
remote:        npm ERR! peer @sanity/client@"^2.11.0" from next-sanity-image@3.2.1
remote:        npm ERR! node_modules/next-sanity-image
remote:        npm ERR!   next-sanity-image@"^3.2.1" from the root project
remote:        npm ERR! 
remote:        npm ERR! Conflicting peer dependency: @sanity/client@2.23.2
remote:        npm ERR! node_modules/@sanity/client
remote:        npm ERR!   peer @sanity/client@"^2.11.0" from next-sanity-image@3.2.1
remote:        npm ERR!   node_modules/next-sanity-image
remote:        npm ERR!     next-sanity-image@"^3.2.1" from the root project
remote:        npm ERR! 
remote:        npm ERR! Fix the upstream dependency conflict, or retry
remote:        npm ERR! this command with --force, or --legacy-peer-deps
remote:        npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Here is my package.json:

{
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start"
  },
  "dependencies": {
    "@emotion/react": "^11.9.3",
    "@emotion/styled": "^11.9.3",
    "@mui/icons-material": "^5.8.4",
    "@mui/material": "^5.8.6",
    "@sanity/client": "^3.3.2",
    "@sanity/image-url": "^1.0.1",
    "get-youtube-id": "^1.0.1",
    "next": "latest",
    "next-sanity": "^0.5.2",
    "next-sanity-image": "^3.2.1",
    "nprogress": "^0.2.0",
    "react": "18.1.0",
    "react-dom": "18.1.0",
    "react-hook-form": "^7.33.1",
    "react-portable-text": "^0.4.3",
    "react-youtube": "^9.0.3",
    "sharp": "^0.30.7"
  },
  "devDependencies": {
    "@types/node": "17.0.35",
    "@types/nprogress": "^0.2.0",
    "@types/react": "18.0.9",
    "@types/react-dom": "18.0.5",
    "autoprefixer": "^10.4.7",
    "postcss": "^8.4.14",
    "tailwindcss": "^3.1.2",
    "typescript": "4.7.2"
  },
  "cacheDirectories": [
    ".next/cache"
  ],
  "name": "project",
  "version": "1.0.0",
  "engines": {
    "node": "16.x"
  },
  "main": "next.config.js",
  "author": "hey",
  "license": "ISC"
}

Much appreciated!

  • [this](https://stackoverflow.com/questions/64936044/fix-the-upstream-dependency-conflict-installing-npm-packages) gives more info on the error you're facing – Akber Iqbal Jul 19 '22 at 01:25

2 Answers2

0

Try deleting your node_modules folder and package.lock file and run npm install again

Jeroen
  • 311
  • 2
  • 14
0

first you disconnect your web server after then you install your npm packages if that is not work, your packages is not support in your versio

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 15 '22 at 03:33