Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read properties of undefined (reading 'length') #54646

Closed
bcherkezovtf opened this issue Feb 28, 2024 · 5 comments
Closed

TypeError: Cannot read properties of undefined (reading 'length') #54646

bcherkezovtf opened this issue Feb 28, 2024 · 5 comments
Labels
area: compiler Issues related to `ngc`, Angular's template compiler needs reproduction This issue needs a reproduction in order for the team to investigate further
Milestone

Comments

@bcherkezovtf
Copy link

bcherkezovtf commented Feb 28, 2024

Which @angular/* package(s) are the source of the bug?

compiler-cli

Is this a regression?

Yes

Description

I'm trying to build a library, and I'm receiving the error bellow.
It is something related to typescript version, it can be seen from the exception too. When i change the ts version to 5.0 for example the error changes.

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 'length')
    at fileExtensionIs (node_modules/typescript/lib/typescript.js:6601:17)
    at tryRemoveExtension (node_modules/typescript/lib/typescript.js:18585:12)
    at removeFileExtension (node_modules/typescript/lib/typescript.js:18577:29)
    at getOutputPathsForBundle (node_modules/typescript/lib/typescript.js:109938:81)
    at getOutputPathsFor (node_modules/typescript/lib/typescript.js:109946:14)
    at forEachEmittedFile (node_modules/typescript/lib/typescript.js:109894:33)
    at verifyCompilerOptions (node_modules/typescript/lib/typescript.js:119001:9)
    at Object.createProgram (node_modules/typescript/lib/typescript.js:116897:5)
    at file:///node_modules/@angular/compiler-cli/bundles/chunk-QRYLMBG3.js:7334:89
    at ActivePerfRecorder.inPhase (file:///node_modules/@angular/compiler-cli/bundles/chunk-HJOPJLIM.js:134:14)

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 16.2.12
Node: 18.19.1
Package Manager: npm 10.2.4
OS: darwin arm64

Angular: 16.2.12
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1602.12
@angular-devkit/build-angular   16.2.12
@angular-devkit/core            16.2.12
@angular-devkit/schematics      16.2.12
@angular/google-maps            16.0.4
@schematics/angular             17.2.1
ng-packagr                      16.2.3
rxjs                            7.8.1
typescript                      5.1.6
zone.js                         0.13.3

Anything else?

No response

@JoostK
Copy link
Member

JoostK commented Feb 28, 2024

There seems to be an issue with your TypeScript config file, as TS crashes when trying to process it.

Without a reproduction this isn't otherwise actionable to us.

@JoostK JoostK added the needs reproduction This issue needs a reproduction in order for the team to investigate further label Feb 28, 2024
@bcherkezovtf
Copy link
Author

bcherkezovtf commented Feb 28, 2024

Thank you for the direction. I start debugging it and find out it was looking for out || outFile property from my tsconfig, so I added one, but now it fails with:

    at checkUnreachable (/node_modules/typescript/lib/typescript.js:44035:25)
    at bindChildren (/node_modules/typescript/lib/typescript.js:41851:11)
    at bind (/node_modules/typescript/lib/typescript.js:43164:11)
    at bindSourceFile2 (/node_modules/typescript/lib/typescript.js:41492:9)
    at bindSourceFile (/node_modules/typescript/lib/typescript.js:41434:5)
    at initializeTypeChecker (/node_modules/typescript/lib/typescript.js:83891:9)
    at createTypeChecker (/node_modules/typescript/lib/typescript.js:46011:5)
    at Object.getTypeChecker (/node_modules/typescript/lib/typescript.js:117526:44)
    at new NgCompiler (file:///node_modules/@angular/compiler-cli/bundles/chunk-QRYLMBG3.js:6539:73)
    at NgCompiler.fromTicket (file:///node_modules/@angular/compiler-cli/bundles/chunk-QRYLMBG3.js:6504:16```

@pkozlowski-opensource pkozlowski-opensource added the area: compiler Issues related to `ngc`, Angular's template compiler label Feb 28, 2024
@ngbot ngbot bot added this to the Backlog milestone Feb 28, 2024
@JoostK
Copy link
Member

JoostK commented Feb 28, 2024

Please provide a reproduction; the out/outFile being omitted shouldn't cause TS to crash, nor should the newly shared stacktrace. But without further insight into your setup, this won't be actionable.

@bcherkezovtf
Copy link
Author

I found out what was causing it. After going through all dependeces again I noticed that @nx/angular was 17.1, not 16.2 like the others deps. After changing it to 16.2 it start building again.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: compiler Issues related to `ngc`, Angular's template compiler needs reproduction This issue needs a reproduction in order for the team to investigate further
Projects
None yet
Development

No branches or pull requests

3 participants