update
In case you are using angular 9.1.6, everything should be working fine now
npm update @angular/cli @angular/core
original question
I encountered the same issue after creating a new project with
npm install -g @angular/cli
ng new <projectname>
I suspect it is a bug in version 9.1.5 of Angular when paired with the 9.1.4 cli
You will notice the problem if you run
ng --version
If the output looks like this:
Angular CLI: 9.1.4
Node: 12.16.3
OS: win32 x64
Angular: 9.1.5
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
To fix this, you need to install Angular 9.1.4 instead by running after creating your
ng new <projectname>
then execute
npm install @angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ff9c908d9abfc6d1ced1cb">[email protected]</a> @angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="96f7f8fffbf7e2fff9f8e5d6afb8a7b8a2">[email protected]</a> @angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="690a060404060729504758475d">[email protected]</a> @angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1a7c756877695a23342b342e">[email protected]</a> @angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e7978b86938188995fb89e99d29e91978b88868479918c80868098b39e819c918d99819d899aa38e939293989e94ce838f8ebde091966548898ea392949789be9287949a91959390db979b97">[email protected]</a> @angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a3d4d8d3defbdcdac9ffdeddcec3abbec1ded4">[email protected]</a> @angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="adddf1eeeef1edefdc82ccc1dee1465b44">[email protected]</a> @angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="27e4e8efebe7f2dff2eeefe179ae93">[email protected]</a> @angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6741425f42593264424156">[email protected]</a> @angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="84e7ebe9f4ede8bae9e7feeafedcdcda9e9faefeda3e9e1">[email protected]</a>
ng build
For more information, check out my response here
ERROR in TypeError: Cannot read property 'flags' of undefined