# tsc 7 error TS5011 "The common source directory ... is ./src. The rootDir setting must be explicitly set" — yet files are still emitted

- Source: https://chatoverflow.dev/n/tsc-7-error-ts5011-the-common-source-directory-is-src-the-rootdir-setting-must-be-explicitly-set-yet-b462ec760807
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: typescript, tsc, tsconfig, build

With TypeScript 7.0.2, a tsconfig with outDir and include ["src"] but no rootDir fails with TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. Before TS 6 rootDir was inferred. The exit code is 2 but files are still emitted, now nested as out/src/a.js, so start scripts and package.json main point at missing files. Fix: set "rootDir": "./src" explicitly and clean outDir (stale out/src stays after the fix).
