Error when installing material ui in react - reactjs

I am trying to use material ui core but I am getting an error when installing it with npm in a react and typescript application.
The command I used in the root of the project is:
npm install #mui/material #emotion/react #emotion/styled
Material UI website
The error I got is:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: #mui/core#5.0.0-alpha.54
npm ERR! Found: #types/react#18.0.15
npm ERR! node_modules/#types/react
npm ERR! peerOptional #types/react#"^17.0.0 || ^18.0.0" from #mui/base#5.0.0-alpha.95
npm ERR! node_modules/#mui/base
npm ERR! #mui/base#"5.0.0-alpha.95" from #mui/material#5.10.3
npm ERR! node_modules/#mui/material
npm ERR! #mui/material#"^5.10.3" from the root project
npm ERR! 1 more (#mui/icons-material)
npm ERR! peerOptional #types/react#"^17.0.0 || ^18.0.0" from #mui/icons-material#5.10.3
npm ERR! node_modules/#mui/icons-material
npm ERR! #mui/icons-material#"^5.10.3" from the root project
npm ERR! 9 more (#mui/private-theming, #mui/system, #mui/types, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional #types/react#"^16.8.6 || ^17.0.0" from #mui/core#5.0.0-alpha.54
npm ERR! node_modules/#mui/core
npm ERR! #mui/core#"^5.0.0-alpha.54" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: #types/react#17.0.49
npm ERR! node_modules/#types/react
npm ERR! peerOptional #types/react#"^16.8.6 || ^17.0.0" from #mui/core#5.0.0-alpha.54
npm ERR! node_modules/#mui/core
npm ERR! #mui/core#"^5.0.0-alpha.54" 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.
npm ERR!
npm ERR! See /Users/username/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/username/.npm/_logs/2022-09--debug-0.log
user#User'sPC projectName % npm install #mui/material #emotion/react #emotion/styled
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: #mui/core#5.0.0-alpha.54
npm ERR! Found: #types/react#18.0.15
npm ERR! node_modules/#types/react
npm ERR! peerOptional #types/react#"^17.0.0 || ^18.0.0" from #mui/base#5.0.0-alpha.95
npm ERR! node_modules/#mui/base
npm ERR! #mui/base#"5.0.0-alpha.95" from #mui/material#5.10.3
npm ERR! node_modules/#mui/material
npm ERR! #mui/material#"^5.10.3" from the root project
npm ERR! 1 more (#mui/icons-material)
npm ERR! peerOptional #types/react#"^17.0.0 || ^18.0.0" from #mui/icons-material#5.10.3
npm ERR! node_modules/#mui/icons-material
npm ERR! #mui/icons-material#"^5.10.3" from the root project
npm ERR! 9 more (#mui/private-theming, #mui/system, #mui/types, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional #types/react#"^16.8.6 || ^17.0.0" from #mui/core#5.0.0-alpha.54
npm ERR! node_modules/#mui/core
npm ERR! #mui/core#"^5.0.0-alpha.54" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: #types/react#17.0.49
npm ERR! node_modules/#types/react
npm ERR! peerOptional #types/react#"^16.8.6 || ^17.0.0" from #mui/core#5.0.0-alpha.54
npm ERR! node_modules/#mui/core
npm ERR! #mui/core#"^5.0.0-alpha.54" 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.
npm ERR!
npm ERR! See /Users/username/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/username/.npm/_logs/2022-09-debug-0.log
My relevant package.json is:
"dependencies": {
"#emotion/react": "^11.10.4",
"#emotion/styled": "^11.10.4",
"#mui/core": "^5.0.0-alpha.54",
"#mui/icons-material": "^5.10.3",
"#mui/material": "^5.10.3",
"#mui/styled-engine-sc": "^5.10.3",
},
I removed the #mui/core dependency and then tried the command: npm i --save #mui/core as suggested by the answer in the comment, however I got the following error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving:projectname#0.1.0
npm ERR! Found: react#18.2.0
npm ERR! node_modules/react
npm ERR! react#"^18.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^17.0.2" from #mui/core#5.0.0-alpha.54
npm ERR! node_modules/#mui/core
npm ERR! #mui/core#"^5.0.0-alpha.54" 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.
npm ERR!
npm ERR! See /Users/username/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/username/.npm/_logs/2022-09--debug-0.log
I have no idea what this error means so would appreciate any help thanks!

Run these command
npm config set legacy-peer-deps true
npm i --save #mui/core
npm i #mui/styles

Related

React NPM Error - code ERESOLVE, ERESOLVE could not resolve

In my react-native app, When I try to install npm i google-spreadsheet --save I get below error.
How to fix it ?
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-dom#18.2.0
npm ERR! Found: react#18.1.0
npm ERR! node_modules/react
npm ERR! peer react#"18.1.0" from react-native#0.70.6
npm ERR! node_modules/react-native
npm ERR! peerOptional react-native#">=0.59" from react-redux#8.0.5
npm ERR! node_modules/react-redux
npm ERR! react-redux#"^8.0.5" from the root project
npm ERR! react-native#"0.70.6" from the root project
npm ERR! peer react#"^16.8 || ^17.0 || ^18.0" from react-redux#8.0.5
npm ERR! node_modules/react-redux
npm ERR! react-redux#"^8.0.5" from the root project
npm ERR! 4 more (react-shallow-renderer, react-test-renderer, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^18.2.0" from react-dom#18.2.0
npm ERR! node_modules/react-dom
npm ERR! peerOptional react-dom#"^16.8 || ^17.0 || ^18.0" from react-redux#8.0.5
npm ERR! node_modules/react-redux
npm ERR! react-redux#"^8.0.5" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react#18.2.0
npm ERR! node_modules/react
npm ERR! peer react#"^18.2.0" from react-dom#18.2.0
npm ERR! node_modules/react-dom
npm ERR! peerOptional react-dom#"^16.8 || ^17.0 || ^18.0" from react-redux#8.0.5
npm ERR! node_modules/react-redux
npm ERR! react-redux#"^8.0.5" 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.
npm ERR!
npm ERR! See C:\Users\harry\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\harry\AppData\Local\npm-cache\_logs\2023-02-06T05_01_54_912Z-debug-0.log

React Rich text editor is not installing

I'm trying to use React mui rte from Here but when I tried npm install mui-rte --save its showing the below error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: hiretripple#0.1.0
npm ERR! Found: react#18.2.0
npm ERR! node_modules/react
npm ERR! peer react#"^17.0.0 || ^18.0.0" from #mui/icons-material#5.8.4
npm ERR! node_modules/#mui/icons-material
npm ERR! #mui/icons-material#"^5.8.4" from the root project
npm ERR! peer #mui/icons-material#"^5.0.0" from mui-rte#2.0.1
npm ERR! node_modules/mui-rte
npm ERR! mui-rte#"*" from the root project
npm ERR! peer react#"^17.0.0 || ^18.0.0" from #mui/material#5.8.6
npm ERR! node_modules/#mui/material
npm ERR! #mui/material#"^5.8.5" from the root project
npm ERR! peer #mui/material#"^5.0.0" from mui-rte#2.0.1
npm ERR! node_modules/mui-rte
npm ERR! mui-rte#"*" from the root project
npm ERR! 1 more (#mui/icons-material)
npm ERR! 3 more (#emotion/react, #emotion/styled, react-dom)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^17.0.0" from #mui/styles#5.8.6
npm ERR! node_modules/#mui/styles
npm ERR! peer #mui/styles#"^5.0.0" from mui-rte#2.0.1
npm ERR! node_modules/mui-rte
npm ERR! mui-rte#"*" 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.
How can I resolve the problem? or is there any other best text editor that I can use?
You can install this package using
npm install --legacy-peer-deps
Then try to install your package

Dependencies conflict with react#17.0.2 #apollo/react-common#3.1.4

I am using #apollo in my react project and I keep getting this error
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: #apollo/react-common#3.1.4
npm ERR! Found: react#17.0.2
npm ERR! node_modules/react
npm ERR! react#"^17.0.2" from the root project
npm ERR! peerOptional react#"^16.8.0 || ^17.0.0 || ^18.0.0" from #apollo/client#3.6.8
npm ERR! node_modules/#apollo/client
npm ERR! #apollo/client#"^3.6.8" from the root project
npm ERR! #apollo/client#"latest" from #apollo/react-components#4.0.0
npm ERR! node_modules/#apollo/react-components
npm ERR! #apollo/react-components#"^4.0.0" from the root project
npm ERR! 1 more (#apollo/react-hooks)
npm ERR! 18 more (#emotion/react, #material-ui/core, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.8.0" from #apollo/react-common#3.1.4
npm ERR! node_modules/#apollo/react-common
npm ERR! #apollo/react-common#"^3.1.4" from the root project
npm ERR! #apollo/react-common#"^3.1.4" from #apollo/react-ssr#3.1.5
npm ERR! node_modules/#apollo/react-ssr
npm ERR! #apollo/react-ssr#"^3.1.5" from react-apollo#3.1.5
npm ERR! node_modules/react-apollo
npm ERR! react-apollo#"^3.1.5" from the root project
npm ERR! 5 more (#apollo/react-hooks, react-apollo, ...)
npm ERR!
npm ERR! Conflicting peer dependency: react#16.14.0
npm ERR! node_modules/react
npm ERR! peer react#"^16.8.0" from #apollo/react-common#3.1.4
npm ERR! node_modules/#apollo/react-common
npm ERR! #apollo/react-common#"^3.1.4" from the root project
npm ERR! #apollo/react-common#"^3.1.4" from #apollo/react-ssr#3.1.5
npm ERR! node_modules/#apollo/react-ssr
npm ERR! #apollo/react-ssr#"^3.1.5" from react-apollo#3.1.5
npm ERR! node_modules/react-apollo
npm ERR! react-apollo#"^3.1.5" from the root project
npm ERR! 5 more (#apollo/react-hooks, react-apollo, ...)
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.
npm ERR!
npm ERR! See /home/runner/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2022-06-17T09_09_33_753Z-debug-0.log
make: *** [Makefile:35: node_modules] Error 1
Error: Process completed with exit code 2.
I tried to use the --legacy-peer-deps but in vain.
JFY, I am using these dependencies
"#apollo/client": "^3.6.8"
"#apollo/react-common": "^3.1.4"
"#apollo/react-components": "^4.0.0"
"#apollo/react-hooks": "^4.0.0"
"react": "^17.0.2"
You should downgrade your react version to react#"^16.8.0" in package.json because #apollo/react-common#3.1.4 reports is incompatible with 17. You must wait until they upgrade or remove the package.

Problem with installing react 18 + typescript + redu-toolkit

I have a problem with creating project with new react 18/ typescript and redux-toolkit.
I am trying to install #reduxjs/toolkit, but I see an error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: #reduxjs/toolkit#1.8.0
npm ERR! Found: react#18.0.0
npm ERR! node_modules/react
npm ERR! peer react#"*" from #testing-library/react#12.1.4
npm ERR! node_modules/#testing-library/react
npm ERR! #testing-library/react#"^12.1.4" from the root project
npm ERR! peer react#"^18.0.0" from react-dom#18.0.0
npm ERR! node_modules/react-dom
npm ERR! peer react-dom#"*" from #testing-library/react#12.1.4
npm ERR! node_modules/#testing-library/react
npm ERR! #testing-library/react#"^12.1.4" from the root project
npm ERR! react-dom#"^18.0.0" from the root project
npm ERR! 2 more (react-scripts, the root project)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional react#"^16.9.0 || ^17.0.0 || 18.0.0-beta" from #reduxjs/toolkit#1.8.0
npm ERR! node_modules/#reduxjs/toolkit
npm ERR! #reduxjs/toolkit#"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react#17.0.2
npm ERR! node_modules/react
npm ERR! peerOptional react#"^16.9.0 || ^17.0.0 || 18.0.0-beta" from #reduxjs/toolkit#1.8.0
npm ERR! node_modules/#reduxjs/toolkit
npm ERR! #reduxjs/toolkit#"*" 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 will be fixed by a new release in the next few days - until then you will have to run the command with --force or --legacy-peer-deps as shown in the command.
Edit: should be working now: https://twitter.com/acemarke/status/1509540340088328196

react suite (rsuite) package installation is failing

When I tried to install rsuite (version 4.9.3) package using the command,
npm i rsuite
I am getting this error. Can anyone help me with this installation process?
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: react#17.0.1
npm ERR! node_modules/react
npm ERR! peer react#"*" from #testing-library/react#11.2.5
npm ERR! node_modules/#testing-library/react
npm ERR! #testing-library/react#"^11.2.5" from the root project
npm ERR! peer react#"^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" from mini-create-react-context#0.4.1
npm ERR! node_modules/mini-create-react-context
npm ERR! mini-create-react-context#"^0.4.0" from react-router#5.2.0
npm ERR! node_modules/react-router
npm ERR! react-router#"5.2.0" from react-router-dom#5.2.0
npm ERR! node_modules/react-router-dom
npm ERR! react-router-dom#"^5.2.0" from the root project
npm ERR! 1 more (the root project)
npm ERR! 6 more (react-dom, react-router, react-router-dom, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^15.3.0 || ^16.0.0-alpha" from react-virtualized#9.22.3
npm ERR! node_modules/rsuite/node_modules/react-virtualized
npm ERR! react-virtualized#"^9.21.0" from rsuite#4.9.3
npm ERR! node_modules/rsuite
npm ERR! rsuite#"*" 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.
npm ERR!
npm ERR! See /home/mikhil/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/mikhil/.npm/_logs/2021-03-22T06_42_23_555Z-debug.log
You try the following command
npm install --force
or
npm install --legacy-peer-deps

Resources