Repository navigation
Description
Command
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
19
Description
The following is in an empty project created via ng new with all defaults selected.
First I run the dev server and open my Chrome browser (clean install, no extensions installed).
I have the following code saved in my app.component.html:
<p><strong>foo</strong></p>I delete the opening <strong> tag, and save (or my editor auto-saves, which makes this annoying).
<p>foo</strong></p>In my terminal, I see the dev server has reported the problem:
Application bundle generation failed. [0.108 seconds]
✘ [ERROR] NG5002: Unexpected closing tag "strong". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags [plugin angular-compiler]
src/app/app.component.html:2:5:
2 │ foo</strong>
╵ ~~~~~~~~~
Error occurs in the template of component AppComponent.
src/app/app.component.ts:7:15:
7 │ templateUrl: './app.component.html',
╵ ~~~~~~~~~~~~~~~~~~~~~~
Oops! I add the opening tag back and save again:
<p><strong>foo</strong></p>The dev server rebuilds, no errors this time.
Browser bundles
Initial chunk files | Names | Raw size
polyfills.js | polyfills | 90.20 kB |
main.js | main | 2.20 kB |
styles.css | styles | 95 bytes |
| Initial total | 92.50 kB
But my browser now displays this error:
TypeError: ɵgetOrCreateAngularServerApp is not a function
at _AngularAppEngine.eval (/home/exac/WebstormProjects/get-or-create-angular-server-app-is-not-a-function/.angular/cache/19.2.4/get-or-create-angular-server-app-is-not-a-function/vite/deps_ssr/chunk-J6AJWQHP.js:11513:25)
at Generator.next (<anonymous>)
at fulfilled (/home/exac/WebstormProjects/get-or-create-angular-server-app-is-not-a-function/.angular/cache/19.2.4/get-or-create-angular-server-app-is-not-a-function/vite/deps_ssr/chunk-YHCV7DAQ.js:72:24)
at _ZoneDelegate.invoke (/home/exac/WebstormProjects/get-or-create-angular-server-app-is-not-a-function/.angular/vite-root/get-or-create-angular-server-app-is-not-a-function/node_modules/zone.js/fesm2015/zone-node.js:369:28)
at ZoneImpl.run (/home/exac/WebstormProjects/get-or-create-angular-server-app-is-not-a-function/.angular/vite-root/get-or-create-angular-server-app-is-not-a-function/node_modules/zone.js/fesm2015/zone-node.js:111:43)
at eval (/home/exac/WebstormProjects/get-or-create-angular-server-app-is-not-a-function/.angular/vite-root/get-or-create-angular-server-app-is-not-a-function/node_modules/zone.js/fesm2015/zone-node.js:1221:40)
at _ZoneDelegate.invokeTask (/home/exac/WebstormProjects/get-or-create-angular-server-app-is-not-a-function/.angular/vite-root/get-or-create-angular-server-app-is-not-a-function/node_modules/zone.js/fesm2015/zone-node.js:402:33)
at ZoneImpl.runTask (/home/exac/WebstormProjects/get-or-create-angular-server-app-is-not-a-function/.angular/vite-root/get-or-create-angular-server-app-is-not-a-function/node_modules/zone.js/fesm2015/zone-node.js:159:47)
at drainMicroTaskQueue (/home/exac/WebstormProjects/get-or-create-angular-server-app-is-not-a-function/.angular/vite-root/get-or-create-angular-server-app-is-not-a-function/node_modules/zone.js/fesm2015/zone-node.js:581:35)
My browser's console logs:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
And now my browser is stuck on the page displaying the error, and won't reload on any more changes.
As a developer, I expect the dev server to recover every time I save.
Apologies if this is a duplicate, or belongs in another repo (vite? another Angular repo?). I couldn't find a report exactly like this.
Minimal Reproduction
Environment: This happens when running the dev server directly on my development machine. I can't reproduce this in StackBlitz after saving ~20 times.
- Install a new Angular project using the defaults.
- Run
ng serve - Change
app.component.htmlto<p><strong>foo</strong></p> - Save and watch the dev server reload the page
- Change
app.component.htmlto<p>foo</strong></p>. Save. - Change
app.component.htmlto<p><strong>foo</strong></p>. Save. - See the error in the browser
ɵgetOrCreateAngularServerApp is not a function, if it reloads properly, repeat steps 5 and 6 a few times until it doesn't reload.
Video
20250321-0523-21.7071165.mp4
Exception or Error
TypeError: ɵgetOrCreateAngularServerApp is not a function
at _AngularAppEngine.eval (/home/exac/WebstormProjects/get-or-create-angular-server-app-is-not-a-function/.angular/cache/19.2.4/get-or-create-angular-server-app-is-not-a-function/vite/deps_ssr/chunk-J6AJWQHP.js:11513:25)
at Generator.next (<anonymous>)
at fulfilled (/home/exac/WebstormProjects/get-or-create-angular-server-app-is-not-a-function/.angular/cache/19.2.4/get-or-create-angular-server-app-is-not-a-function/vite/deps_ssr/chunk-YHCV7DAQ.js:72:24)
at _ZoneDelegate.invoke (/home/exac/WebstormProjects/get-or-create-angular-server-app-is-not-a-function/.angular/vite-root/get-or-create-angular-server-app-is-not-a-function/node_modules/zone.js/fesm2015/zone-node.js:369:28)
at ZoneImpl.run (/home/exac/WebstormProjects/get-or-create-angular-server-app-is-not-a-function/.angular/vite-root/get-or-create-angular-server-app-is-not-a-function/node_modules/zone.js/fesm2015/zone-node.js:111:43)
at eval (/home/exac/WebstormProjects/get-or-create-angular-server-app-is-not-a-function/.angular/vite-root/get-or-create-angular-server-app-is-not-a-function/node_modules/zone.js/fesm2015/zone-node.js:1221:40)
at _ZoneDelegate.invokeTask (/home/exac/WebstormProjects/get-or-create-angular-server-app-is-not-a-function/.angular/vite-root/get-or-create-angular-server-app-is-not-a-function/node_modules/zone.js/fesm2015/zone-node.js:402:33)
at ZoneImpl.runTask (/home/exac/WebstormProjects/get-or-create-angular-server-app-is-not-a-function/.angular/vite-root/get-or-create-angular-server-app-is-not-a-function/node_modules/zone.js/fesm2015/zone-node.js:159:47)
at drainMicroTaskQueue (/home/exac/WebstormProjects/get-or-create-angular-server-app-is-not-a-function/.angular/vite-root/get-or-create-angular-server-app-is-not-a-function/node_modules/zone.js/fesm2015/zone-node.js:581:35)
Your Environment
exac@DESKTOP-58AJUTF:~/WebstormProjects/get-or-create-angular-server-app-is-not-a-function$ ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 19.2.4
Node: 20.18.3
Package Manager: npm 10.8.2
OS: linux x64
Angular: 19.2.3
... common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1902.4
@angular-devkit/build-angular 19.2.4
@angular-devkit/core 19.2.4
@angular-devkit/schematics 19.2.4
@angular/cli 19.2.4
@angular/ssr 19.2.4
@schematics/angular 19.2.4
rxjs 7.8.2
typescript 5.7.3
zone.js 0.15.0
Anything else relevant?
No response
Activity
imaksp commentedon Mar 21, 2025
I was having difficulty in reproducing this error on new app, good to see this, also if you make any new change in file like adding empty space it should recover.
alan-agius4 commentedon Mar 21, 2025
@Exac, thank you for the detailed and insightful issue report!
fix(@angular/build): handle undefined `getOrCreateAngularServerApp` d…
fix(@angular/build): handle undefined `getOrCreateAngularServerApp` d…
fix(@angular/build): handle undefined `getOrCreateAngularServerApp` d…
angular-automatic-lock-bot commentedon Apr 21, 2025
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.