diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 0bb87cc5a4..1ced01fb34 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -498,6 +498,11 @@ namespace ts { const files = _fs.readdirSync(path || ".").sort(); const directories: string[] = []; for (const current of files) { + // This is necessary because on some file system node fails to exclude + // "." and "..". See https://github.com/nodejs/node/issues/4002 + if (current === "." || current === "..") { + continue; + } const name = combinePaths(path, current); if (!contains(exclude, getCanonicalPath(name))) { const stat = _fs.statSync(name);