TypeError: Cannot read properties of undefined (reading 'match') when running application
See original GitHub issueWhich @angular/* package(s) are the source of the bug?
compiler, Don’t known / other
Is this a regression?
Yes
Description
After upgrading to Angular 13, I have started seeing this error whenever I start up the application:
TypeError: Cannot read properties of undefined (reading 'match')
at extractCommentsWithHash (:5000/vendor.js:290935)
at ShadowCss.shimCssText (:5000/vendor.js:290454)
at :5000/vendor.js:306725
at Array.map (<anonymous>)
at compileStyles (:5000/vendor.js:306724)
at compileComponentFromMetadata (:5000/vendor.js:306169)
at CompilerFacadeImpl.compileComponentFromMeta (:5000/vendor.js:306920)
at CompilerFacadeImpl.compileComponent (:5000/vendor.js:306908)
at Function.get (:5000/vendor.js:348767)
at getComponentDef (:5000/vendor.js:321523)
I believe this might be regression as I have seen other tickets mention this issue, but most of them say that the culprit is the existence of module: commonjs
in the tsconfig file, but this is not the case for me.
I have also manually modified the angular.json file to explicitly say that I am using scss, but the error still persists, and only at runtime.
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
TypeError: Cannot read properties of undefined (reading 'match')
at extractCommentsWithHash (:5000/vendor.js:290935)
at ShadowCss.shimCssText (:5000/vendor.js:290454)
at :5000/vendor.js:306725
at Array.map (<anonymous>)
at compileStyles (:5000/vendor.js:306724)
at compileComponentFromMetadata (:5000/vendor.js:306169)
at CompilerFacadeImpl.compileComponentFromMeta (:5000/vendor.js:306920)
at CompilerFacadeImpl.compileComponent (:5000/vendor.js:306908)
at Function.get (:5000/vendor.js:348767)
at getComponentDef (:5000/vendor.js:321523)
Please provide the environment you discovered this bug in (run ng version
)
Angular CLI: 13.0.3
Node: 16.13.0
Package Manager: npm 8.1.3
OS: win32 x64
Angular: 13.0.2
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1300.3
@angular-devkit/build-angular 13.0.3
@angular-devkit/core 13.0.3
@angular-devkit/schematics 13.0.3
@angular/cli 13.0.3
@schematics/angular 13.0.3
rxjs 6.6.7
typescript 4.4.4
Anything else?
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
TypeError: Cannot read properties of undefined (reading 'match')
I have managed to tsolve the issue by setting in my tsconfig.json "target": "es2020", tsconfig.app.json "module": "es2020", tsconfig.spec.json " ...
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError: Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >Cannot read property .match of undefined - Heroku Help
Running an npm command, such as npm install or npm ci , may raise something like this: npm err TypeError: Cannot read property...
Read more >Cannot read properties of undefined (reading 'match')
Hey devs what could be reason of this error when interacting with smart contract? Cannot read properties of undefined (reading 'match').
Read more >How to Avoid the Infamous "Cannot read properties of ... - Bitovi
That error message is telling you the function is returning undefined implicitly, but its return type does not include undefined in it. Awesome!...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you don’t have any
module
set it will default tocommonjs
if the syntaxtarget
ises5
or lower.Can you try to set the
module
toes2020
in your root level tsconfig?Thanks for linking the tickets, Alan. I had initially come across this ticket, but removing all of the
CommonJS
references I could find didn’t resolve my issue. I’ll try to get a minimum repro done today.