2

I'm getting the below error when I do npm install in my project

npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

npm ERR! code ERESOLVE

npm ERR! ERESOLVE could not resolve

npm ERR!

npm ERR! While resolving: react-scripts@4.0.1

npm ERR! Found: typescript@4.1.3

npm ERR! node_modules/typescript

npm ERR! dev typescript@"^4.1.3" from the root project

npm ERR! peer typescript@">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" from tsutils@3.21.0

npm ERR! node_modules/tsutils

npm ERR! tsutils@"^3.21.0" from @typescript-eslint/eslint-plugin@4.28.3

npm ERR! node_modules/@typescript-eslint/eslint-plugin

npm ERR! peer @typescript-eslint/eslint-plugin@"^4.0.0" from eslint-config-react-app@6.0.0

npm ERR! node_modules/eslint-config-react-app

npm ERR! eslint-config-react-app@"^6.0.0" from react-scripts@4.0.1

npm ERR! node_modules/react-scripts

npm ERR! 2 more (eslint-plugin-jest, react-scripts)

npm ERR! tsutils@"^3.21.0" from @typescript-eslint/typescript-estree@4.28.3

npm ERR! node_modules/@typescript-eslint/typescript-estree

npm ERR! @typescript-eslint/typescript-estree@"4.28.3" from @typescript-eslint/experimental-utils@4.28.3

npm ERR! node_modules/@typescript-eslint/experimental-utils

npm ERR! @typescript-eslint/experimental-utils@"4.28.3" from @typescript-eslint/eslint-plugin@4.28.3

npm ERR! node_modules/@typescript-eslint/eslint-plugin

npm ERR! 1 more (eslint-plugin-jest)

npm ERR! 1 more (@typescript-eslint/parser)

npm ERR! 1 more (@typescript-eslint/typescript-estree)

npm ERR!

npm ERR! Could not resolve dependency:

npm ERR! peerOptional typescript@"^3.2.1" from react-scripts@4.0.1

npm ERR! node_modules/react-scripts

npm ERR! dev react-scripts@"^4.0.1" from the root project

npm ERR!

npm ERR! Conflicting peer dependency: typescript@3.9.10

npm ERR! node_modules/typescript

npm ERR! peerOptional typescript@"^3.2.1" from react-scripts@4.0.1

npm ERR! node_modules/react-scripts

npm ERR! dev react-scripts@"^4.0.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.

This is my package.json

{
  "name": "node_modules",
  "version": "1.0.7",
  "private": true,
  "license": "ISC",
  "dependencies": {
    "@microsoft/applicationinsights-react-js": "^2.3.1",
    "@microsoft/applicationinsights-web": "^2.3.1",
    "@progress/kendo-common": "^0.2.1",
    "@progress/kendo-data-query": "^1.5.4",
    "@progress/kendo-drawing": "^1.9.3",
    "@progress/kendo-file-saver": "^1.1.0",
    "@progress/kendo-react-charts": "^3.18.0",
    "@progress/kendo-react-common": "^3.18.0",
    "@progress/kendo-react-inputs": "^3.18.0",
    "@progress/kendo-react-intl": "^3.18.0",
    "@progress/kendo-react-layout": "^3.18.0",
    "@progress/kendo-react-popup": "^3.18.0",
    "@progress/kendo-theme-default": "^4.32.0",
    "@progress/kendo-theme-material": "^3.28.0",
    "@telerik/kendo-intl": "^2.3.0",
    "async": "^2.6.4",
    "azure-maps-control": "^2.0.31",
    "ejs": "^3.1.7",
    "hammerjs": "^2.0.8",
    "jquery": "^3.5.1",
    "kendo-ui-react": "^0.14.2",
    "minimist": "^1.2.6",
    "react": "^16.9.0",
    "react-dom": "^16.9.0",
    "typescript-collections": "^1.3.3",
    "web-vitals": "^0.2.4",
    "y18n": "^5.0.5"
  },
  "devDependencies": {
    "@fortawesome/fontawesome-free": "^5.15.2",
    "@testing-library/jest-dom": "^5.11.9",
    "@testing-library/react": "^11.2.3",
    "@testing-library/user-event": "^12.6.2",
    "@types/history": "^4.7.8",
    "@types/jest": "^26.0.20",
    "@types/jquery": "^3.5.5",
    "@types/node": "^12.19.15",
    "@types/react": "^16.9.0",
    "@types/react-dom": "^16.9.0",
    "react-scripts": "^4.0.1",
    "typescript": "^4.1.3"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

I don't understand how to fix this issue.

lepsch
  • 8,927
  • 5
  • 24
  • 44
Pranoy Tez
  • 25
  • 1
  • 8

2 Answers2

7

Try doing npm install --legacy-peer-deps

ReetS
  • 197
  • 1
  • 8
0

While @Reets's answer did work for me. Apart from that this also works to me:

npm install --force

Xin
  • 33,823
  • 14
  • 84
  • 85