Repository navigation
Closed
Description
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
Yes
Description
What I did so far:
npm i -g @angular/cli@latestng new ng-upskill-app- Removed the HTML in app.component.html (left the router-outlet only)
- Added the control flow blocks a shown in the image.
- saw the errors
I can't reproduce this again 🙁
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
> [email protected] start
> ng serve
Initial Chunk Files | Names | Raw Size
polyfills.js | polyfills | 82.71 kB |
main.js | main | 23.47 kB |
styles.css | styles | 96 bytes |
| Initial Total | 106.28 kB
Application bundle generation complete. [3.385 seconds]
Watch mode enabled. Watching for file changes...
➜ Local: http://localhost:4200/
Initial Chunk Files | Names | Raw Size
main.js | main | 23.50 kB |
Unchanged output files: 2
Application bundle generation complete. [0.513 seconds]
Reloading client(s)...
Initial Chunk Files | Names | Raw Size
main.js | main | 2.14 kB |
Unchanged output files: 2
Application bundle generation complete. [0.201 seconds]
Reloading client(s)...
✘ [ERROR] File 'src/app/app.component.ts' is missing from the TypeScript compilation. [plugin angular-compiler]
src/main.server.ts:2:29:
2 │ import { AppComponent } from './app/app.component';
╵ ~~~~~~~~~~~~~~~~~~~~~
Ensure the file is part of the TypeScript program via the 'files' or 'include' property.
Application bundle generation failed. [0.165 seconds]
✘ [ERROR] File 'src/app/app.component.ts' is missing from the TypeScript compilation. [plugin angular-compiler]
src/main.server.ts:2:29:
2 │ import { AppComponent } from './app/app.component';
╵ ~~~~~~~~~~~~~~~~~~~~~
Ensure the file is part of the TypeScript program via the 'files' or 'include' property.
Please provide the environment you discovered this bug in (run ng version)
Angular CLI: 17.0.0
Node: 18.17.0
Package Manager: npm 9.6.7
OS: darwin arm64
Angular: 17.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router, ssr
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1700.0
@angular-devkit/build-angular 17.0.0
@angular-devkit/core 17.0.0
@angular-devkit/schematics 17.0.0
@schematics/angular 17.0.0
rxjs 7.8.1
typescript 5.2.2
zone.js 0.14.2
Anything else?
No response
Reacted by Sylvain Dumont
Metadata
Metadata
Assignees
Labels
No labels
Activity
clydin commentedon Nov 8, 2023
Unfortunately, we are unable to reproduce the problem as described.
If possible can you provide a project with a minimal reproduction that demonstrates the problem?
rainerhahnekamp commentedon Nov 12, 2023
In my project that error happens on a regular basis.
Here's the link: https://github.com/rainerhahnekamp/angular-local-change-detection.
Just make some syntax errors in the template, and the message will show up.
Two things that might be of interest:
elgerm commentedon Nov 13, 2023
Anyone that did not see this happening isn't programming with v17. It happens all the time.
At random, say, every 5-6 saves.
Edit: Downgraded from node 20.9.0 to node 18 and see no more errors.
toddhd commentedon Nov 16, 2023
I don't know why this was closed, the problem still exists. I am running Node v18.17.1 and Angular 17 which I just downloaded yesterday. I created a new project yesterday, it worked fine, went to bed. Got up, went to go keep working on the project, and got this error.
After a while I gave up, decided to just create new project all over again, so I created a new project. (ng new test) and chose scss and no precompile support. When I go to run the project, I get the error again.
Here is my package.json:
I'm not sure how to fix this?
Jose1Useche commentedon Nov 23, 2023
@toddhd , I saw this in this link:
I finally found a solution, and did open a ticket with the Angular team about it. I honestly can't tell you why it ever worked, or why it works for most people and not others, however, I can tell you what fixed it. Another user on the Angular support forums tried this fix as well and confirmed it worked for them as well.
Go into the angular.json file, and add a "preserveSymlinks": true as indicated below:
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:application",
"options": {
"preserveSymlinks": true,
MasonVX commentedon Nov 28, 2023
I'm also having the same issue. "preserveSymlinks": true did not help for me. I had it a few times the last few days, but today I have it with each save of a file. When I update template files it does not recognize any change at all.
I just realized that when I save a ts file without changing anything the compiler complains. If I put an empty line into it, it fixes itself. But it's having every time.
I'm on the current version of everything angular: 17.0.4
jacekkoziol commentedon Nov 30, 2023
I'm facing the same issue. After updating Angular to version 17.0.4 and changing the
builderto@angular-devkit/build-angular:applicationeverything went smoothly until suddenly it started to throw the error:"preserveSymlinks": true didn't solve the problem
For a few minutes after the update, it was working fine.
The application is building correctly with
ng build.I've just updated all the
@angularpackages to version17.0.5and the issue still exists :/jacekkoziol commentedon Nov 30, 2023
I've solved the problem in my case by removing the option
"aot": false,fromangular.jsonMasonVX commentedon Nov 30, 2023
That helped, thanks.
clydin commentedon Nov 30, 2023
If you are still encountering issues with the latest version, please provide the full output of
ng versionand if possible a minimal reproduction in a new issue. Also please ensure that all the Angular packages have been updated. The majority of the build system is in the@angular-devkit/build-angularpackage. The OS being used is also highly relevant (and the shell if on Windows) and will help the team troubleshoot more effectively.zlatanov commentedon Nov 30, 2023
I've just upgraded to v17 and
"builder": "@angular-devkit/build-angular:application"and started getting this error when editing something.I had
"aot": falsein dev build and just like @jacekkoziol suggested, removing it fixed the issue.MasonVX commentedon Dec 1, 2023
Hi,
I just did a simple test, I created a brand new app with "ng new". I testet it and everything was fine.
I changed "aot": to false and restarted the devserver.
Now the devserver showed the strange behavior:
My system:
MacOS 14.1.1
NodeJS: v18.14.0
Here is the output of "ng version":

I hope it helps track down the error.
It might also have nothing to do with the original issue, it just manifest the same.
alan-agius4 commentedon Dec 1, 2023
Hi @MasonVX, I am unable to replicate the problems with the steps provided using MacOS. Do you have any special characters in the path or some upper case characters?
MasonVX commentedon Dec 1, 2023
The path I created the app in:
~/Development/test/testApp
And as I said, the only thing I changed for the starter project is set aot to false:

Edit: terminal is zsh
MasonVX commentedon Dec 1, 2023
Update: I also now tried a new starter project in ~/ called test. Same problem. I also tried bash instead of zsh, no change.
nodejs is installed via nvm
alan-agius4 commentedon Dec 1, 2023
@MasonVX, I am still unable to replicate this when aot is disabled.
MasonVX commentedon Dec 1, 2023
Ok, I'm being honest, I have no idea what it could be. I even tried an update to npm v18.19.0 but it didn't help as well. I also deleted .angular and also node_modules.
I mean I'm not the only one. I could try to debug it myself, if you can give me a hint where to look, but I guess I would have to setup a whole Angular CLI dev environment.
mahidehassan commentedon Dec 5, 2023
i don't even have
aotwithin my angular.json file , but still gettingFile 'src\app\app.component.ts' is missing from the TypeScript compilation. src/main.server.ts:2:29Error after 6/7/8 saves.-> Angular v17.0.0, node 20.9.0
TinyDinosaur commentedon Dec 11, 2023
I don't understand whi is this closed why is this closed... The
aotis not a solution. This is happening to me and its become more and more annoying. I'll paste my setup:AjChaudhary00 commentedon Dec 18, 2023
Symlinks and Project Structure:
It's possible that your project uses symbolic links (symlinks) for organizing files or directories, and the main.ts file might be part of a symlinked structure. When Angular CLI runs the TypeScript compiler, it follows the links and expects to find the TypeScript files in the specified locations.
preserveSymlinks: true:
By setting preserveSymlinks: true in the angular.json file, you instructed the Angular CLI to preserve the symbolic links during the build process. This means that when the TypeScript compiler looks for files, it respects the symbolic links and includes the files that are part of the symlinked structure.
TypeScript Compilation Process:
The TypeScript compiler (tsc) is responsible for compiling TypeScript code into JavaScript. When building an Angular project, the Angular CLI uses tsc under the hood. If the compilation process encounters symlinked files and doesn't preserve symlinks, it might miss files or encounter unexpected issues.
angular.json Configuration:
The angular.json file contains the configuration for your Angular project, including build settings. The preserveSymlinks: true option is part of this configuration and affects how the build process handles symbolic links.
angular-automatic-lock-bot commentedon Jan 18, 2024
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.