1

Getting ERESOLVE error when trying to npm i enter image description here

Here is the Package.json file

{
  "name": "client-forntend",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@material-ui/core": "^4.11.3",
    "@material-ui/data-grid": "^4.0.0-alpha.26",
    "@material-ui/icons": "^4.11.2",
    "@material-ui/lab": "^4.0.0-alpha.57",
    "@material-ui/styles": "^4.11.4",
    "@material-ui/system": "^4.11.3",
    "axios": "^0.21.1",
    "classnames": "^2.3.1",
    "material-ui-chip-input": "^1.1.0",
    "moment": "^2.29.1",
    "prop-types": "^15.7.2",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-emoji": "^0.5.0",
    "react-facebook-login": "^4.1.1",
    "react-file-base64": "^1.0.3",
    "react-redux": "^7.2.2",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.3",
    "redux": "^4.0.5",
    "redux-thunk": "^2.3.0",
    "web-vitals": "^1.1.0"
  },
  "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"
    ]
  }
}

This project was untouched for the last one year. Now its not running. So, i have tried thisrm -rf node_modules package-lock.json and re-installed node_modules didn't worked. now it's not installing packages.

How can I resolve this error?

Sajib
  • 79
  • 1
  • 7
  • im assuming you have already tried installing with legacy peer deps? – Fiehra Sep 17 '22 at 17:01
  • @Fiehra yes, I have done this already. no luck – Sajib Sep 17 '22 at 17:05
  • @Sajib have you also tried running npm I --force? – g0rb Sep 17 '22 at 17:08
  • @g0rb yes mate. I have tried this too, and maybe all the existing methods from StackOverflow. – Sajib Sep 17 '22 at 17:10
  • @Sajib Could you show us the errors you get when running `npm i --force`? Also have you tried removing node_modules and package-lock.json then running `npm i --force`? – g0rb Sep 17 '22 at 17:18
  • 2
    I ran into this a while back. If you have updated node and npm since the last time you ran this project, you may see these dependency errors. Ever since Node v7, it installs dependencies in a more strict mode. `npm install --legacy-peer-deps` will make it act like it did pre-version 7. A better explanation here>>> https://stackoverflow.com/questions/66239691/what-does-npm-install-legacy-peer-deps-do-exactly-when-is-it-recommended-wh – ckesplin Sep 18 '22 at 01:27
  • @g0rb it shows something like this, ```node:internal/modules/cjs/loader:494 throw e; ^ Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/tokenize' is not defined by "exports" in ``` And after installing legacy-peers, if I run, then it show's like this, ```node:internal/modules/cjs/loader:949 throw err; ^ Error: Cannot find module 'webpack'``` – Sajib Sep 18 '22 at 04:37
  • Delete `material-ui-chip-input` dependency and install again. – Hamed Siaban Sep 18 '22 at 05:48
  • @Sajib, is there a .nvm file in your project? Do you know which version of node you were using when you originally installed this project? It may be an issue with your node version. – g0rb Sep 18 '22 at 18:19
  • @g0rb no, there isn't any .nvm file. I was using a different version of Node. Maybe I was using node version 16, and now I am using node version 18... Now, I am trying to use all the newer versions of the dependency which are compatible with the latest react and node versions. hope so this will work. – Sajib Sep 19 '22 at 09:13
  • @Sajib, alright keep us updated. – g0rb Sep 19 '22 at 16:04

0 Answers0