133

I want to install neumorphism-react package.

But I got this error

Module not found: Can't resolve '@emotion/react' in 'C:\Users\Asus\Desktop\react projects\visitor\node_modules@emotion\styled\base\dist'

Here are the dependencies in package.json

"@emotion/core": "^11.0.0",
"@emotion/styled": "^11.0.0",
"@testing-library/jest-dom": "^5.11.6",
"@testing-library/react": "^11.2.2",
"@testing-library/user-event": "^12.6.0",
"neumorphism-react": "^1.1.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.1",
"semantic-ui-react": "^2.0.1",
"web-vitals": "^0.2.4"
1
  • 4
    Looks like you're needing the @emotion/react package, it's no in your dependency and obviously not being included in your dependencies' dependencies either Commented Dec 29, 2020 at 1:58

20 Answers 20

171

I had a similar issue and I resolved it by calling:

npm install @emotion/react

or

yarn add @emotion/react
Sign up to request clarification or add additional context in comments.

4 Comments

After installing the package a restart of npm might be needed. Just stop the server and run npm start.
after this error i got Can´t resolve @emotion/styled
This plus restarting the app server worked.
Make sure that you add ALL necessary packages. In my case it was @emotion/utils @emotion/cache @emotion/serialize.
149

I had a similar issue and I resolved it by calling:

npm install @emotion/react 
npm install @emotion/styled

or

 yarn add @emotion/react
 yarn add @emotion/styled

Comments

20

I had a similar issue and I resolved it by calling:

for the npm:

npm install @emotion/react 
npm install @emotion/styled

for the yarn:

yarn add @emotion/react
yarn add @emotion/styled

For specific version you can install like : @emotion/[email protected] & @emotion/styled

in npm:

npm install @emotion/[email protected]
npm install @emotion/styled

in yarn:

yarn add @emotion/[email protected]
yarn add @emotion/styled

Comments

20

For those who are using nextJS, try to delete the .next dir after installing the dependencies.

1 Comment

My god! You saved me.
17

An all-stop solution...

npm install @mui/material @emotion/react @emotion/styled

Comments

14

if you use npm:

npm install  @emotion/react

if you use yarn:

yarn add @emotion/react

but in recent version they rename the package @emotion/core to @emotion/react, if you use other package that are depending on @emotion/core

  • that mean you need to hook up to source code and update import statement to the new @emotion/react

or downgrade package to older versions with npm

npm install @emotion/[email protected]

with yarn

yarn add @emotion/[email protected]

Comments

9

YOU NEED INSTALL : @emotion/react AND @emotion/styled WHILE @mui/material is installed and sometimes it look likes that it've finished but still no proggress, at these cases just w8 and it will finish depend on your connection speed

npm install @mui/material @emotion/react @emotion/styled

or

npm install @mui/material 
npm install @emotion/react 
npm install @emotion/styled

visit this for installation docs Installation MUI

1 Comment

It’s amazing. It’s as if dependencies are a completely foreign concept to some people.
5

None of these solutions worked for me. I resolved it by running:

npm install @emotion/server

I am using mui with nextjs.

Comments

2

'yarn install' or 'node install' at the directory of package.json.

I'm looking at the docs, the package you're trying to use may not exist.

Make sure you are importing from the current library. For example:

import { NeuButton } from "neumorphism-react";

Comments

2

TLDR for those who are using nextJS-

  1. Rerun npm run dev to allow nextJS to rebuild the needed files.
  2. Delete the .next folder like @FusionDevelopers suggested.

Explanation- when you run dev next builds a lot of the stuff to be served so when you're installing new libraries they won't necessarily be included in that build meaning your project will shout that it misses the things you already installed. One option, as @FusionDevelopers suggested is to delete the .next folder, another option is to restart the nextjs server that'll rebuild everything including the newly installed packages.

Comments

2

using:

npm install @emotion/styled --force
npm install @emotion/react --force

worked for me

Comments

1

Only this worked for me:

npm i @emotion/styled @emotion/core

Comments

1

Add below commands into package.json under Dependencies

"@emotion/core": "^11.0.0",
"@emotion/react": "^11.8.2",
"@emotion/styled": "^11.8.1",

Run npm install

Comments

1

I had the same issue. I tried npm install @emotion/react but it didn't solve my problem because I already had the package installed.

I restarted VS Code and the linter was happy 😀

1 Comment

went through the exact same thing. Spent a good chunk of time trying to figure out what was going wrong, and it turned out a simple restart did the trick! 😄
1

I had the same error and resolved it by running the below commands.

npm install @emotion/react
npm install @emotion/core
npm install @emotion/styled 

These commands will install the emotion package to the dependencies of your project.

after this, make sure you restart your development server and your IDE if necessary. Your dev server won't pick up the changes until you stop it and re-run the npm start command.

also, install the @emotion/css package if you are using CSS as well.

If the error is still there then, try to delete your node_modules and package-lock.json file (not package.json) files, re-run npm install, and restart your IDE.

visit for more information: https://bobbyhadz.com/blog/react-module-not-found-cant-resolve-emotion-react

Comments

0

And after installing don't forget to restart your localhost, npm start

Comments

0

I had all of the above and still was getting the error. I ended up deleting the yarn.lock & node_modules and the run yarn again

Comments

0

You may need to remove the package definitions from package.json before running

npm install @emotion/react @emotion/styled

Until I did that, it wasn't working for me.

Comments

0

Execute these two instructions:

I add this statement:

 npm install @emotion/styled

then i add this statement:

 npm update @emotion/styled

With the previous two steps, the problem was solved in my code.

If the problem isn't resolved, you can perform the next step:

npm install -g @emotion/styled

Comments

0

I am using mui+nextjs. I was able to resolve by running below

npm install @mui/material-nextjs @emotion/cache

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.