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

angular-compiler: Cannot read properties of undefined (reading 'startName') #52540

Closed
1 task done
zip-fa opened this issue Nov 6, 2023 · 12 comments
Closed
1 task done
Assignees
Labels
area: core Issues related to the framework runtime state: has PR
Milestone

Comments

@zip-fa
Copy link

zip-fa commented Nov 6, 2023

Command

build, serve

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

Hi.
After updating to rc3 my project is not going to compile/build. Also my build process in dev server is never-ending and doesn't give me error.
Also i see these errors, which are not true, because they are persist in my tsconfig and everything seems to be building on rc2:

File 'server.ts' is missing from the TypeScript compilation
File 'src\main.server.ts' is missing from the TypeScript compilation.

I ran schematics to migrate to new control flow, maybe this is related.
Still need to review 400 components and will give you repro.

Minimal Reproduction

ng serve / ng build

Exception or Error

X [ERROR] Cannot read properties of undefined (reading 'startName') [plugin angular-compiler]

  This error came from the "onStart" callback registered here:

    node_modules/@angular-devkit/build-angular/src/tools/esbuild/angular/compiler-plugin.js:89:18:
      89 │             build.onStart(async () => {
         ╵                   ~~~~~~~

    at setup (C:\node_modules\@angular-devkit\build-angular\src\tools\esbuild\angular\compiler-plugin.js:89:19)
    at async handlePlugins (C:\node_modules\esbuild\lib\main.js:1340:9)


X [ERROR] File 'src\main.ts' is missing from the TypeScript compilation. [plugin angular-compiler]

  Ensure the file is part of the TypeScript program via the 'files' or 'include' property.


X [ERROR] File 'src\main.server.ts' is missing from the TypeScript compilation. [plugin angular-compiler]

  Ensure the file is part of the TypeScript program via the 'files' or 'include' property.


X [ERROR] File 'server.ts' is missing from the TypeScript compilation. [plugin angular-compiler]

  Ensure the file is part of the TypeScript program via the 'files' or 'include' property.


Application bundle generation failed. [17.522 seconds]

Your Environment

Angular CLI: 17.0.0-rc.3
Node: 18.18.1
Package Manager: npm 9.8.1
OS: win32 x64

Angular: 17.0.0-rc.2
... animations, cdk, common, compiler, compiler-cli, core, forms
... localize, material, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1700.0-rc.3
@angular-devkit/build-angular   17.0.0-rc.3
@angular-devkit/core            17.0.0-rc.3
@angular-devkit/schematics      17.0.0-rc.3
@angular/cli                    17.0.0-rc.3
@angular/ssr                    17.0.0-rc.3
@schematics/angular             17.0.0-rc.3
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.0

Anything else relevant?

No response

@alan-agius4
Copy link
Contributor

This seems like a bug but we'll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please?

You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.

This might be related to your directory structure so its really important to get an accurate repro to diagnose this.

@zip-fa
Copy link
Author

zip-fa commented Nov 6, 2023

@alan-agius4 i can confirm that this exists on rc2, rc1 and rc2.
Also i don't have any output on esbuild-builder/application builder, but i receive bunch of errors on good-old browser builder.
I will need more time to investigate what exactly caused this, because i tried to migrate my whole project, which consists of ~400 components

@zip-fa
Copy link
Author

zip-fa commented Nov 6, 2023

@alan-agius4 i was doing a repro with @for bug, but this error encountered:

https://stackblitz.com/edit/angular-at-rb12vs?file=src%2Fmain.ts

@clydin
Copy link
Member

clydin commented Nov 6, 2023

That appears to be a defect in Web Containers (used inside StackBlitz).
You should be able to workaround the bug by changing the package.json start script to:

"start": "NG_BUILD_PARALLEL_TS=0 ng serve",

EDIT: This comment was related to the previous comment's issue (#52540) and not the issue reported originally.

@zip-fa
Copy link
Author

zip-fa commented Nov 6, 2023

I receive same error on my Windows PC. Will try to reproduce.

@zip-fa
Copy link
Author

zip-fa commented Nov 6, 2023

I managed to reproduce what caused this behavior.

Take a look at this:
https://github.com/zip-fa/ng17-i18n-control-flow-bug

control flow inside i18n block leads to never-ending build with esbuild-based builders on Windows system, while with browser builder it throws this error:

./src/main.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Cannot read properties of undefined (reading 'startName')

@zip-fa
Copy link
Author

zip-fa commented Nov 6, 2023

@alan-agius4 that happened after automatic migration from *ngIf to control flow. This is the code, which was working before:

<button class="button button_block button_submit" type="button">
        <div class="button__text" i18n="@@payment.crypto.charge">Пополнить<span class="button__currency" *ngIf="cryptoAmount && cryptoAmount > 0"> на {{ cryptoAmount }} {{ currentMethod.currencyCode | uppercase }}</span></div>
      </button>

@alan-agius4
Copy link
Contributor

Transfer to the FW repo since this is not caused by the CLI.

@alan-agius4 alan-agius4 transferred this issue from angular/angular-cli Nov 6, 2023
@zip-fa
Copy link
Author

zip-fa commented Nov 7, 2023

Transfer to the FW repo since this is not caused by the CLI.

But with esbuild-builders there is no visible errors on Windows PC, it just shows “Building…” text in console indefinitely. On other hand, webpack gives trace to what caused this

@alan-agius4
Copy link
Contributor

That solved the solved in the latest RC

@jessicajaniuk jessicajaniuk added the area: core Issues related to the framework runtime label Nov 8, 2023
@ngbot ngbot bot added this to the needsTriage milestone Nov 8, 2023
@crisbeto crisbeto self-assigned this Nov 12, 2023
@vpallathu
Copy link

vpallathu commented Nov 13, 2023

I still see the error with version v17.0.0. I don't see any new npm version than v17.0.0. Should I use the interim version v17.0.2?

crisbeto added a commit to crisbeto/angular that referenced this issue Nov 16, 2023
Adds support for generating i18n instructions inside of blocks.

Fixes angular#52540.
Fixes angular#52767.
crisbeto added a commit to crisbeto/angular that referenced this issue Nov 16, 2023
Adds support for generating i18n instructions inside of blocks.

Fixes angular#52540.
Fixes angular#52767.
crisbeto added a commit to crisbeto/angular that referenced this issue Nov 17, 2023
Adds support for generating i18n instructions inside of blocks.

Fixes angular#52540.
Fixes angular#52767.
crisbeto added a commit to crisbeto/angular that referenced this issue Nov 17, 2023
Adds support for generating i18n instructions inside of blocks.

Fixes angular#52540.
Fixes angular#52767.
AndrewKushnir pushed a commit that referenced this issue Nov 20, 2023
Adds support for generating i18n instructions inside of blocks.

Fixes #52540.
Fixes #52767.

PR Close #52958
tbondwilkinson pushed a commit to tbondwilkinson/angular that referenced this issue Dec 6, 2023
Adds support for generating i18n instructions inside of blocks.

Fixes angular#52540.
Fixes angular#52767.

PR Close angular#52958
@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 Dec 21, 2023
ChellappanRajan pushed a commit to ChellappanRajan/angular that referenced this issue Jan 23, 2024
Adds support for generating i18n instructions inside of blocks.

Fixes angular#52540.
Fixes angular#52767.

PR Close angular#52958
rlmestre pushed a commit to rlmestre/angular that referenced this issue Jan 26, 2024
Adds support for generating i18n instructions inside of blocks.

Fixes angular#52540.
Fixes angular#52767.

PR Close angular#52958
amilamen pushed a commit to amilamen/angular that referenced this issue Jan 26, 2024
Adds support for generating i18n instructions inside of blocks.

Fixes angular#52540.
Fixes angular#52767.

PR Close angular#52958
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: core Issues related to the framework runtime state: has PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants