-
Notifications
You must be signed in to change notification settings - Fork 10.3k
aspnetcore 3.1 angular project timeout on MacOS #18820
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
Comments
@ajaybhargavb can you reproduce this on an OSX machine? We have automated tests for this running on Windows, so this seems suspect. |
I tried it and I can't reproduce this. Here is my
@stuki, this could be something to do with a borked npm installation. Here is my dotnet build
|
@ajaybhargavb Thanks for testing! I reinstalled node and got at least the build steps working. But it still does not start the Angular project for me. I tried with node v10.19.0 and v12.15.0. I redid the steps in Windows and the project got up and running, but no such luck on MacOS. If I go to the ClientApp folder and run it manually ( |
@stuki Hei Oscar, tjenare... ;) I had the same problem after upgrading to angular 9, if your version is angular 9 the following might help. Based on my working workaround, this problems is due to conflicting pre renderers between angular 9 and .net, all versions I think. Also visual studio at least with windows uses typescript version 3.7.0 while Angular 9 uses 3.7.5 yet is perfectly happy with 3.7.0 so change to that in your package json, also comment out the following line in your main.ts: export { renderModule, renderModuleFactory } from '@angular/platform-server'; I am still playing about with it so in my package.json I have "aspnet-prerendering": "3.0.1" that is where I think the main conflict lies. Doing that makes my solution work again under angular 9 I will try tro remove the "aspnet-prerendering": "3.0.1" instead of the last line in my main.ts since "aspnet-prerendering": "3.0.1" is obsolete and no longer supported. Not sure if that is what causes your problems, but that is where I would start. Let me know if this solved it for you or if you got other error messages plaguing you... |
I had this same problem on Windows as well with Angular 9, simply uninstalling the "aspnet-prerendering" (now deprecated) package fixed the loading for me, now when starting the project it doesn't time out, and works just as intended. |
Thanks, I've been trying that and failing, possibly due to a failed ssr installation, working with removing it all... |
@geferon unfortunately, no joy, if I do not use aspnet-prerendering I need to use the @angular/platform-server to spin it up yet I am not using server side rendering and when I do, I get an error, with statement not allowed in strict mode... A work around i found there was to fist spin up the server using @angular/platform-server in the main.ts and then, after it spins up yet fails, comment that thing out again. Very frustrating. I am going to create a new fresh .net core 3.1 angular 9 project to see if the problem persists and if not use it to analyse my config ...frustrating... |
@David-Ben-Mesecke have you found any solution? I have the same problem... |
Based on feedback found in the Windows side of things, try this combined approach: In package.json, under "scripts", update the "start" script to: Some folks seem to thing that adding the echo statement helps while others think that the --host attribute helps. I can attest to the first one helping at first, then the second one running with the baton when the first one quit making a difference! ... and this is what happens when you involve Microsoft ... UPDATE: Worked once like a champ and then back to normal ... I'm thinking @David-Ben-Mesecke is on to something! 😂 |
Sorry for the late reply. I ended up with a workaround that worked for me, simply save a ts file so that the compiler has to recompile the ts code and it works. Given it isn't a problem that translates into the release, I have not bothered to find out why, yet I suspect that the second time around, it is using the ivy compiler while visual studio is trying to use the old compiler somehow. What is important for me is that this way I get it working and I really do not restart my debug sessions often enough for me to bother about the few extra seconds it takes to compile the code a second time. |
I tried @dcchristopher solution too, it works like a charm for me too. I guess I stick you your solution dcc, its easier since I do not have to recompile to make things work. |
Thanks for contacting us. |
Describe the bug
Creating a new project using
dotnet new angular -o my-app
does not create a working project. The project stalls on serving the angular frontend, resulting in timeouts.To Reproduce
dotnet new angular -o my-app
)cd my-app
)dotnet build
)dotnet run
)What happens:
The request hangs for a while (depending on the
spa.Options.StartupTimeout
set) and then fails.On closer inspection,
dotnet build
does not even install the packages for the angular project.What I expect to happen:
The backend should automatically start the frontend, and render the front page.
dotnet build
should install npm packages for the frontend projectFurther technical details
The text was updated successfully, but these errors were encountered: