New Jun 30, 2025

npm install fails due to conflicting peer dependencies (ERESOLVE error) [closed]

Libraries, Frameworks, etc. All from Newest questions tagged reactjs - Stack Overflow View npm install fails due to conflicting peer dependencies (ERESOLVE error) [closed] on stackoverflow.com

I'm trying to run npm install lodash in my project, but I get a long list of dependency conflicts. The error code is ERESOLVE, and it seems related to conflicting versions of packages like ajv, @apideck/better-ajv-errors, and several @material-ui / @mui components.

I’m using React 18 and some older versions of Material UI (@material-ui/core@4.12.4) along with newer packages like @mui/x-date-pickers@6.20.2. I suspect the conflict is coming from mixing @material-ui/* (v4) and @mui/* (v5) packages.

Here’s a snippet of the error:

                  npm install lodash

npm warn ERESOLVE overriding peer dependency npm warn While resolving: @apideck/better-ajv-errors@0.3.6 npm warn Found: ajv@7.2.4 npm warn node_modules/ajv npm warn dev ajv@"^7.2.4" from the root project npm warn npm warn Could not resolve dependency: npm warn peer ajv@">=8" from @apideck/better-ajv-errors@0.3.6 npm warn node_modules/@apideck/better-ajv-errors npm warn @apideck/better-ajv-errors@"^0.3.1" from workbox-build@6.6.0 npm warn node_modules/workbox-build npm warn npm warn Conflicting peer dependency: ajv@8.17.1 npm warn node_modules/ajv npm warn peer ajv@">=8" from @apideck/better-ajv-errors@0.3.6 npm warn node_modules/@apideck/better-ajv-errors npm warn @apideck/better-ajv-errors@"^0.3.1" from workbox-build@6.6.0 npm warn node_modules/workbox-build npm error code ERESOLVE npm error ERESOLVE could not resolve npm error npm error While resolving: @material-ui/core@4.12.4 npm error Found: @types/react@18.3.23 npm error node_modules/@types/react npm error peerOptional @types/react@"*" from @material-ui/types@5.1.0 npm error node_modules/@material-ui/types npm error @material-ui/types@"5.1.0" from @material-ui/core@4.12.4 npm error node_modules/@material-ui/core npm error @material-ui/core@"^4.12.4" from the root project npm error @material-ui/types@"5.1.0" from @material-ui/styles@4.11.5 npm error node_modules/@material-ui/styles npm error @material-ui/styles@"^4.11.5" from @material-ui/core@4.12.4 npm error node_modules/@material-ui/core npm error @material-ui/core@"^4.12.4" from the root project npm error peerOptional @types/react@"^17.0.0 || ^18.0.0 || ^19.0.0" from @mui/base@5.0.0-beta.40-1 npm error node_modules/@mui/base npm error @mui/base@"5.0.0-beta.40-1" from @mui/lab@5.0.0-alpha.176 npm error node_modules/@mui/lab npm error @mui/lab@"^5.0.0-alpha.163" from the root project npm error @mui/base@"^5.0.0-beta.22" from @mui/x-date-pickers@6.20.2 npm error node_modules/@mui/x-date-pickers npm error @mui/x-date-pickers@"^6.9.0" from the root project npm error 1 more (@mui/x-tree-view) npm error 11 more (@mui/icons-material, @mui/lab, @mui/material, ...) npm error npm error Could not resolve dependency: npm error peerOptional @types/react@"^16.8.6 || ^17.0.0" from @material-ui/core@4.12.4 npm error node_modules/@material-ui/core npm error @material-ui/core@"^4.12.4" from the root project npm error npm error Conflicting peer dependency: @types/react@17.0.87 npm error node_modules/@types/react npm error peerOptional @types/react@"^16.8.6 || ^17.0.0" from @material-ui/core@4.12.4 npm error node_modules/@material-ui/core npm error @material-ui/core@"^4.12.4" from the root project npm error npm error Fix the upstream dependency conflict, or retry npm error this command with --force or --legacy-peer-deps npm error to accept an incorrect (and potentially broken) dependency resolution. npm error npm error npm error For a full report see: npm error C:\Users\User\AppData\Local\npm-cache_logs\2025-06-30T09_39_27_343Z-eresolve-report.txt npm error A complete log of this run can be found in: C:\Users\User\AppData\Local\npm-cache_logs\2025-06-30T09_39_27_343Z-debug-0.log PS D:\inora\frontend> npm install @mui/material @emotion/react @emotion/styled npm warn ERESOLVE overriding peer dependency npm warn While resolving: @apideck/better-ajv-errors@0.3.6 npm warn Found: ajv@7.2.4 npm warn node_modules/ajv npm warn dev ajv@"^7.2.4" from the root project npm warn npm warn Could not resolve dependency: npm warn peer ajv@">=8" from @apideck/better-ajv-errors@0.3.6 npm warn node_modules/@apideck/better-ajv-errors npm warn @apideck/better-ajv-errors@"^0.3.1" from workbox-build@6.6.0 npm warn node_modules/workbox-build npm warn npm warn Conflicting peer dependency: ajv@8.17.1 npm warn node_modules/ajv

I ran the command:

bash Copy code npm install lodash I expected it to install lodash without issues, since it's a standalone utility library. However, npm threw multiple ERESOLVE errors related to peer dependencies, even though I didn’t touch any of the other dependencies.

Scroll to top