After updating my Windows 10 via a scheduled Microsoft update (I don't really know if this is related, it might also be a coincidence), I started to run into this issue when running yarn start.
undefined
TypeScript error in undefined(undefined,undefined):
Cannot find type definition file for 'component-emitter'.
The file is in the program because:
Entry point for implicit type library 'component-emitter' TS2688
Failed to compile.
I found this similar post, which solved the problem by removing a package with the name @types/ in the package.json. I however have no such package.
Here is my package.json file:
{
"name": "web-localizer",
"version": "0.1.0",
"private": true,
"dependencies": {
"@react-hook/window-size": "^3.0.7",
"@unform/core": "^2.1.0",
"@unform/web": "^2.1.0",
"axios": "^0.19.2",
"date-fns": "^2.14.0",
"polished": "^3.5.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-icons": "^3.10.0",
"react-map-gl": "^6.1.14",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.0",
"react-spinners": "^0.9.0",
"react-spring": "^8.0.27",
"styled-components": "^5.1.0",
"typescript": "^4.2.4",
"uuidv4": "^6.0.8",
"yup": "^0.28.5"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"test:coverage": "react-scripts test --coverage --watchAll false",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"jest": {
"collectCoverageFrom": [
"src/pages/**/*.tsx",
"src/components/**/*.tsx",
"src/hooks/*.tsx",
"!src/hooks/intex.tsx"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/react-hooks": "^3.3.0",
"@testing-library/user-event": "^7.1.2",
"@types/jest": "^24.0.0",
"@types/node": "^12.0.0",
"@types/react": "^16.9.0",
"@types/react-dom": "^16.9.0",
"@types/react-router-dom": "^5.1.5",
"@types/react-star-rating-component": "^1.4.0",
"@types/styled-components": "^5.1.0",
"@types/yup": "^0.28.0",
"@typescript-eslint/eslint-plugin": "^2.29.0",
"@typescript-eslint/parser": "^2.29.0",
"axios-mock-adapter": "^1.18.1",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-prettier": "^6.11.0",
"eslint-import-resolver-typescript": "^2.0.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^2.5.1",
"prettier": "^2.0.5"
}
}
And here is my tsconfig.json file:
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react",
},
"include": [
"src"
],
"typeRoots": [
"../node_modules/@types",
"../@types"
]
}
I was receiving a warning of this sort before, but now I can't even build React apps anymore. This is making me unable to work, so I am a little desperate. If anyone has the slightest idea of what this might be, please let me know as soon as you can. I will provide any extra info that might be necessary.
yarn add @types/component-emitterand then again for all the packages that had the same problem. The packages werecomponent-emitter,cookieandcors. I don't know if this is an issue with create-react-app or the latest version of Windows 10, or both. But this is a problem that I don't really think is fixed, and therefore might happen to other people.