-
Notifications
You must be signed in to change notification settings - Fork 12k
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
File 'src\main.ts' is missing from the TypeScript compilation. #26379
Comments
Mind sharing the broken project please? |
Thanks Alan, please tell me the best way to do that? Should I zip up "test" and send it to you? (Perhaps minus the "node_modules")? |
FYI, I updated to the latest LTS of Node.js and NPM as well. $ npm -v $ node -v Angular CLI: 17.0.0 Angular: 17.0.2 Package Version@angular-devkit/architect 0.1700.0 When I create a new project now, I see this at the end... $ ng n test |
test.zip This is the log from the test app I just created now, that is showing the LF/CRLF erros above (which I have never seen before. This is a Windows 11 machine and has no other OS's on it). |
The
|
Let me ask you this. It's weird that this is happening, and while I understand your comment about the LF's, I noted it to simply point out that something has "changed". I don't normally get those warninigs, and I didn't get them yesterday when I created the initial project which ran just fine... until this morning, when it STOPPED running fine. Which leads me to wonder if the problem has nothing to with what's on my PC, and perhaps everything to do with NPM? I know you probably aren't an NPM expert, but it is possible that when NPM goes to grab files for a build, that it is getting corrupt files? Does everyone get their NPM files from the same source, or is possible that someone in Boston is getting their files from a different location than someone in Los Angeles? If so, maybe you can't reproduce it because you aren't getting them from the same source as I am? |
The mentioned warnings were always present on windows unless
The errors you are setting do not seem to be caused by corrupted NPM packages, to be honest I never encountered corrupted NPM packages being downloaded from public NPM registry. While not everyone get the NPM package from the same server, there are checks in place for that to ensure that the downloaded package is not corrupted. |
Thanks. I'm not sure what else to try then? Here is a link to a video I made of what I'm doing, and what I'm seeing, on my end. Maybe this will help? |
|
Thanks, Also, to be fair, I also have a laptop setup for my dev work, so I just copied the files over there (from the original project) and it works just fine. I was also able to create a new project just fine on the laptop. So I guess it is something local to the PC. Do you happen to have any thoughts on where to even start looking? |
To be perfectly honest, I have no clue. But when I see utterly strange behaviour, I would try by reinstalling node.js. I would recommend using NVM. |
Ok thank you. You can probably close this ticket in that case. If I discover anything pertinent, I'll still update the ticket. Just FYI, I have seen other tickets about this, so it's something weird. I just don't know what. |
https://colin.is/blog/2020/error-main-ts-is-missing-from-the-typescript-compilation/ FYI, still testing, but I think I found the solution (although I can't explain why it worked yesterday). Adding "preserveSymlinks" in the angular.json file seems to fix the issue.
|
Had exactly the same issue, tried re-installing node etc, nothing worked until i too added the "preserveSymlinks": true, to my angular.json |
That is interesting... Is the app being created in a symlink? |
Thanks, It worked for me as well. |
I was using ConEmu as my console if that makes any difference? |
This worked for me as well. I find it strange that I am only seeing the issues when trying to run a project created via
I don't see this issue when downloading any of the source code from the v17 docs though. i.e https://angular.dev/tutorials/learn-angular/output |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
We have a tentative fix for this issue, @toddhd or anyone who is experiencing this issue, could you please verify if using a build snapshot fixes the problem when
|
Thank you! I ran the command above and then attempted to create a new project. No errors this time! :) |
Thanks for the confirmation, this will be available on NPM later next week in 17.0.4. PR that fixes the issue: #26453 |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
@DariusMuscalu, you can still use the webpack based builders with version 17, there is no need to downgrade to version 16. That said, unfortunately without a minimal reproduction we are not able to further action this problem as it appears that your issue does not share the same root cause of the original reported issue. |
facing same issue ! can any one help me please . |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
removing
from my angular.json config fixed my issue, |
Still experiencing this issue with the
|
⠴ Building... I also have a similiar issue, build doesn't work and the REST API example endpoints in server.ts do not work. There is nothing logged to the console when i hit the endpoints, regular false CLI errors that certain components are missing for typescript compilation, worked fine in previous version 16 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Command
build
Is this a regression?
The previous version in which this bug was not present was
16
Description
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 the error below (main.ts is missing).
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?
Minimal Reproduction
This happens upon creation of a new project for me.
ng new test
When asked, select "SCSS" for CSS, and "No" to the question of precompilation features.
When the project is complete, change to the newly created "test" folder and run
ng s --o
Error appears during build.
Exception or Error
Your Environment
Anything else relevant?
This was literally working the evening before. The last thing I did before bed was run the app. I woke up this morning, went to go run it again, and this error appeared.
I would also like to note that I have also tried to uninstall (using npm uninstall, plus I cleared the cache) and reinstall Angular, it made no difference.
The text was updated successfully, but these errors were encountered: