diff --git a/packages/@angular/cli/models/config.ts b/packages/@angular/cli/models/config.ts index e2811a432882..6230d8050533 100644 --- a/packages/@angular/cli/models/config.ts +++ b/packages/@angular/cli/models/config.ts @@ -13,7 +13,12 @@ const CLI_CONFIG_FILE_NAME_ALT = 'angular-cli.json'; function getUserHome() { - return process.env[(process.platform.startsWith('win')) ? 'USERPROFILE' : 'HOME']; + const envHomeName = (process.platform.startsWith('win')) ? 'USERPROFILE' : 'HOME'; + const env = process.env[envHomeName]; + if (env == null) { + throw new Error('Missing environment variable ' + envHomeName); + } + return env; }