tsconfig.json cannot find the file it extends in an Expo project
File 'expo-module-scripts/tsconfig.base' not found.Short answer
TypeScript resolves the extends value with Node.js-style resolution. If the package or the path in extends is misspelled, or the dependencies are not installed, the editor shows 'File not found'. Use expo/tsconfig.base, install expo and typescript, or regenerate the file with npx expo customize tsconfig.json.
Fix it fast
1Find out which cause you have
Open tsconfig.json and compare its extends line character by character with the form Expo documents.
grep -n "extends" tsconfig.json ls node_modules/expo/tsconfig.base* 2>&12Match what you see, then jump to its fix
What does the error look like?
File 'expo-module-scripts/tsconfig.base' not found.
Cause 1 of 2
The extends value is misspelled or names a package you do not use
1Check
Expo documents that a project's tsconfig.json should extend expo/tsconfig.base by default. Any other name has to be a real package or file that exists on disk.
grep -n "extends" tsconfig.json2Fix
Set extends to the Expo base, or regenerate the file from Expo.
{
"extends": "expo/tsconfig.base"
}
# or regenerate
npx expo customize tsconfig.json3Verify
Restart the TypeScript server in the editor and run the compiler.
npx tsc --noEmitConfirmed by docs.expo.dev
Cause 2 of 2
Dependencies are not installed, so the base file is not on disk
1Check
TypeScript resolves extends with Node-style resolution, so the package must exist in node_modules. Check that expo is there.
ls node_modules/expo/package.json2Fix
Install dependencies, and install the TypeScript packages the Expo docs name.
npm install
npx expo install typescript @types/react --dev3Verify
The base file now exists and the error is gone after an editor restart.
ls node_modules/expo/tsconfig.base*Confirmed by docs.expo.dev
How do I stop it coming back?
- Generate tsconfig.json with npx expo customize tsconfig.json instead of copying one from another project.
- Restart Expo CLI after you edit tsconfig.json, as the Expo docs advise.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- TaskvareA task and project-management suite: React on the web, Flutter on mobile, TypeScript underneath.
Related fixes
Web apps
tsconfig rejects allowImportingTsExtensions
An error that allowImportingTsExtensions needs noEmit or emitDeclarationOnly
allowImportingTsExtensions lets files import each other with .ts or .tsx extensions, and TypeScript only allows it together with noEmit or emitDeclarationOnly.
2 causes, each with a fixWeb apps
TypeScript refuses JSX because the jsx option is not set
TS17004: Cannot use JSX unless the '--jsx' flag is provided.
TypeScript compiles JSX only when you name the file with a .tsx extension and enable the jsx compiler option.
2 causes, each with a fixWeb apps
TypeScript rejects a component that returns an array or other non-Element
Its return type 'Element[]' is not a valid JSX element.
TypeScript before 5.1 required every component to return JSX.Element or null, so arrays, strings and Promises were rejected even though React renders them.
2 causes, each with a fixWeb apps
Cypress refuses to start with 'Your configFile is invalid'
Your configFile threw an error from: /path/to/cypress.config.ts
Cypress could not load cypress.config.js or .ts, or found something wrong in it.
5 causes, each with a fixWeb apps
ESLint cannot decide which copy of the @typescript-eslint plugin to use
The message lists two file paths for the same plugin, each with the name of the config that loaded it
ESLint found the same plugin at two different file paths and will not pick one.
3 causes, each with a fixWeb apps
ESLint says it cannot resolve a path to a module that does exist
Unable to resolve path to module 'react'. import/no-unresolved
import/no-unresolved fails when eslint-plugin-import cannot find the file or package on disk with its resolver.
4 causes, each with a fix