Module not found: Can’t resolve ‘@emotion/react’

Using material UI you are relaying on the backbone of npm packages like “@emotion/styled” and “@emotion/react”, this open more opportunity for material UI by google but also can be frustrating to see error of module not found.

Reading into material ui docs it will be easy to see that material ui relay on 2 dependencies however, material ui dose not brings them as peer-dependencies, this is why module not found can be evoke when trying to install material ui directly. and modules like emotion/react can’t resolve. this is why the first thing i tend to do is to read up the docs. reading the docs also makes it easier to decided whether if you want or not to use a specific technology for your work and project. so don’t get stuck with module not found! read the docs first!

Solution

install both packages:

npm install @emotion/react @emotion/styled

This will provide all the dependencies you’ll need for your material UI project.

Leave a Reply

Your email address will not be published. Required fields are marked *

All rights reserved 2024 ©