diff --git a/packages/angular-cli/upgrade/version.ts b/packages/angular-cli/upgrade/version.ts index ca591ef62f63..ae48703e3b4c 100644 --- a/packages/angular-cli/upgrade/version.ts +++ b/packages/angular-cli/upgrade/version.ts @@ -76,6 +76,11 @@ export class Version { const configPath = CliConfig.configFilePath(); + + if (configPath === null) { + return new Version(null); + } + const configJson = readFileSync(configPath, 'utf8'); try { diff --git a/tests/e2e/tests/misc/version.ts b/tests/e2e/tests/misc/version.ts new file mode 100644 index 000000000000..d5d5cbd2a2a5 --- /dev/null +++ b/tests/e2e/tests/misc/version.ts @@ -0,0 +1,10 @@ +import {deleteFile} from '../../utils/fs'; +import {ng} from '../../utils/process'; + + +export default function() { + return ng('version') + .then(() => deleteFile('angular-cli.json')) + // doesn't fail on a project with missing angular-cli.json + .then(() => ng('version')); +}