Challenges arise with dependencies during the installation of MUI

[insert image description here][1]

I attempted to add mui styles and other components to my local machine, but encountered a dependency error. How can I resolve this issue? [1]: https://i.stack.imgur.com/gqxtS.png

npm install @mui/styles
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="503122333839240f2735322339243510607e617e60">[email protected]</a>
npm ERR! Found: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="46342327253206777e68746876">[email protected]</a>
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.0" from @mui/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9fecebe6f3faecdfaab1a6b1af">[email protected]</a>
npm ERR! node_modules/@mui/styles
npm ERR!   @mui/styles@"*" 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/home/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/home/.npm/_logs/2022-07-15T16_59_52_863Z-debug-0.log

I also experimented with npm install @mui/styles --force but unfortunately, it did not resolve the issue

Answer №1

@mui/styles does not currently support React version 18. For compatibility issues, refer to the legacy API documentation here: https://mui.com/system/styles/api/

@mui/styles is not compatible with React.StrictMode or React 18.

There are two possible solutions:

You can explore alternative styling libraries. Alternatively, consider using/installing @mui/system instead.

Please consult this MUI document for more information: https://mui.com/system/basics/

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Apply CSS styling (or class) to each element of a React array of objects within a Component

One issue I'm facing involves adding specific properties to every object in an array based on another value within that same object. One such property is the background color. To illustrate, consider an array of objects: let myObj = { name: "myO ...

Interaction issue with Material UI and React tabs: hovering fails to open and close tabs correctly

I am currently immersed in a project that involves React and Material UI. My goal is to create tabs that trigger a menu upon hovering, but I seem to be facing some challenges with this functionality. That's why I'm reaching out here for assistanc ...

What is the method to render certain text as bold using a json string?

I need assistance with concatenating two strings in react while ensuring that the first string is displayed in bold, while the second one remains unchanged. The first string I want to emphasize is stored in a JSON file, and the second string comes from an ...

How to effectively manage errors in TypeScript using RxJS?

Exploring subscribe arguments in the official RxJS documentation has raised some interesting questions for me. For instance, what is the purpose of using error: (e: string) => { ... } to catch errors emitted by an observable? Despite this implementation ...

Tips for updating a functional component when the parent state changes

Is there a way to trigger a re-render of a functional child component when the parent state changes? When dealing with a class component as a child, I can use componentWillReceiveProps to solve this issue. However, my child component is a functional one. ...

Discovering a way to retrieve objects from an array of objects with matching IDs

Here is a code snippet I put together to illustrate my objective. arr = [ { id:1 , name:'a', title: 'qmummbw' }, { id:2 , name:'b', title: 'sdmus' }, { id:2 , name:'', title: 'dvfv' }, ...

Utilizing TypeScript for enhanced Chrome notifications

I am currently developing a Chrome app using TypeScript (Angular2) and I want to implement push notifications. Here is the code snippet for my notification service: import {Injectable} from 'angular2/core'; @Injectable() export class Notificati ...

What is the best way to pass a variable and its corresponding state-updating function as a prop in a React component?

Considering I have a variable defined as follows: const [APIKey, setAPIKey] = useState([]) Is it possible to group these together into a single variable and then pass it as a prop? const passAPI = {APIKey, setAPIKey} Here is my approach to passing it alo ...

Using the `minDate` prop in Material-ui Datepicker will take precedence over the default null state

I am facing an issue with a component where the minDate in the material-ui Datepicker is taking precedence over the null value and setting the minDate as the selected value. Furthermore, it also triggers the onChange function automatically. Here is my comp ...

The hexagons configuration for tsParticles is experiencing technical difficulties

I'm struggling to implement the tsParticles library (specifically using react-tsparticles) in combination with the latest version of Next.js. However, when I try to use the particle.json file and bind it to the <Particles/> component, the partic ...

The React Material-UI Tab component threw an error message saying "Looking for an element type capable of holding a reference."

Currently, I am working on implementing React MUI Tabs into my project and encountering the following issue: Warning: Failed prop type: Invalid prop component supplied to ForwardRef(ButtonBase). Expected an element type that can hold a ref. Did you accid ...

Make sure to confirm that 'tables-basic' is an Angular component within the module before proceeding

In my table-basic.component.ts file, I declared 'tables-basic' as a selector and included this template in dashboard.html. Despite following the steps outlined below, I encountered an error which is also highlighted. Snippet from my dashboard.te ...

Creating Multiple Result Lists in MUI Autocomplete Based on Option Properties: A Step-by-Step Guide

I have a query about displaying results using the MUI Autocomplete component. I am looking to categorize the results into two separate lists placed side by side. Currently, I have a working searchbar with one list of results. However, I aim to segregate t ...

Do Not Activate the Android App with Deeplink in Ionic3

I'm currently using the ionic-plugin-deeplinks to enable deep linking within my app. Here are the steps I followed: $ ionic cordova plugin add ionic-plugin-deeplinks --variable URL_SCHEME=myapp --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOS ...

ReactJS buttons update their color when clicked

Utilizing Material UI Buttons in ReactJS, I currently have 3 buttons within my project. <> <Button variant="contained">Button 1</Button> <Button variant="contained">Button 2</Button> <Button variant="contained">Button3& ...

Encountering a hydration error with the useResponsive hook in Nextjs Material UI

I am facing an issue with a useResponsive hook that relies on useMediaQuery from the Material-UI library. While using Next.js with app router, the initial value of the hook returns false and then transitions to true, causing a hydration mismatch. How can I ...

Tips for customizing the appearance of a Material UI Accordion: adjusting divider lines and collapse icons

I have set out to design a unique Material UI accordion that resembles this image: https://i.stack.imgur.com/ZWzCq.png My attempt at creating this customized MUI accordion involves the following code structure (this accordion also integrates custom search ...

The react-redux developer tool appears to be disabled and is not displaying the current state of the application on the extension toolbar

Just finished the redux-tutorial and attempting to view the state in the redux-devtools. However, the redux-devtools seems to be inactive on the extensions bar. Upon clicking it, a menu appears with options like "to right, to left etc". Selecting one of ...

Exploring the process of developing specialized middleware in ReactJS for enhancing reducer functionality

How can I ensure my reducer updates when the API sends a response with an updated token? I attempted to dispatch an action from middleware, but unfortunately the reducer keeps getting reset to its initial state. ...

Tips for Emulating Tab Behavior with the Enter Key on Material-UI Dialog Input Fields

In my React project utilizing Material-UI, I encountered a challenge with managing input focus within a dialog. Within the dialog, there are multiple input fields, and I aim to modify the default behavior so that pressing Enter shifts focus to the next inp ...