Module not found: Can't resolve '@emotion/react'
ReactjsReactjs Problem Overview
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"
Reactjs Solutions
Solution 1 - Reactjs
I had a similar issue and I resolved it by calling:
npm install @emotion/react
or
yarn add @emotion/react
Solution 2 - Reactjs
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
Solution 3 - Reactjs
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/core@10.1.1
npm install @emotion/styled
in yarn:
yarn add @emotion/core@10.1.1
yarn add @emotion/styled
Solution 4 - Reactjs
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/core@10.1.1
with yarn
yarn add @emotion/core@10.1.1
Solution 5 - Reactjs
An all-stop solution...
npm install @mui/material @emotion/react @emotion/styled
Solution 6 - Reactjs
'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";
Solution 7 - Reactjs
Only this worked for me:
npm i @emotion/styled @emotion/core
Solution 8 - Reactjs
None of these solutions worked for me. I resolved it by running:
npm install @emotion/server
I am using mui with nextjs.