From 75163ce0afbf8c00d4110b6b34629ac7270e2e6d Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Sun, 22 Dec 2019 19:13:45 +0100 Subject: [PATCH] fix(common): Debug Failure. False expression: node_modules/@types/node/ts3.2/index.d.ts linked to nonexistent file Fixes: #1413 --- modules/common/schematics/add/index.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/common/schematics/add/index.ts b/modules/common/schematics/add/index.ts index 2c675a409..59d06949b 100644 --- a/modules/common/schematics/add/index.ts +++ b/modules/common/schematics/add/index.ts @@ -221,12 +221,21 @@ function routingInitialNavigationRule(options: UniversalOptions): Rule { return host.read(fileName).toString().replace(/^\uFEFF/, ''); }; tsHost.directoryExists = function (directoryName: string): boolean { - const dir = host.getDir(directoryName); - return !!(dir.subdirs.length || dir.subfiles.length); + // When the path is file getDir will throw. + try { + const dir = host.getDir(directoryName); + + return !!(dir.subdirs.length || dir.subfiles.length); + } catch { + return false; + } }; tsHost.fileExists = function (fileName: string): boolean { return host.exists(fileName); }; + tsHost.realpath = function (path: string): string { + return path; + }, tsHost.getCurrentDirectory = function () { return host.root.path; };