emotion: create-react-app failed to compile
Current behavior:
When npm install @emotion/core and/or @emotion/styled after setting up a typescript project with create-react-app the app failed to compile even though I didn’t import emotion in the project.
To reproduce:
- npx create-react-app vz-app --template typescript
- npm install --save @emotion/core @emotion/styled
Expected behavior:
Should render the create-react-app landing page correctly.
Environment information:
reactversion: 16.12.0@emotion/styledversion: 10.0.23
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (5 by maintainers)
I think this just is caused by a fact that you install extra dependencies with npm, while the existing node_modules has been created with yarn. It’s some kind of a mismatch between those 2 installs - if I remove all node_modules & lock files and do a fresh
npm install(which includes already added emotion dependencies) then everything works OK.npm i @types/reactandnpm i @types/react-domremoving the error.so npx create-react-app use yarn under the hood ? it’s pretty annoying if there is no way to specifiy if we want to use npm instead. By removing all
node_modulesandnpm installit solved my problem so I am going to close this issue. Thank you !found that should be the problem of emotion is missing types in its folder for version 11.1
falling back to 10.1.1 works
npm install --save typescript @types/node @types/react @types/react-dom @types/jest
removed the error