I started a new project yesterday but after a few hours experimenting I get this error:
An unhandled exception occurred while processing the request.
NodeInvocationException: The Node invocation timed out after 60000ms.
You can change the timeout duration by setting the InvocationTimeoutMilliseconds property on NodeServicesOptions.The first debugging step is to ensure that your Node.js function always invokes the supplied callback (or throws an exception synchronously), even if it encounters an error. Otherwise, the .NET code has no way to know that it is finished or has failed.
Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance+d__14.MoveNext()
If I follow documentation for removing server rendering, app works.
When I execute npm run build:dev the progress takes arround 55seconds. (If that helps)
Sometimes issues like that can come up if the webpack build just takes too too long and you can usually just refresh again and everything will work, this is my fault on he Dev webpack side and I'll be improving performance there this next week (along with many other things).
I'll close this one out as we're tracking #217 to fix these slow compilation issues. Thank you @MaklaCof !
Just to inform. Refresh does not work. I even restart machine and it does not work.
Great work by the way.
@MarkPieszak
If it helps: it stops working when I add enough 3rd party components. In my case when I add entire Kendo UI for Angular 2.
I haven't tried using kendo with it myself, but I'm assuming it's either a slow build issue / or that they're using window/document etc.
What errors come up in the Output from Node? @MaklaCof
Hm, that is interesting. A billion errors and actually only one:
Microsoft.AspNetCore.NodeServices:Error: ERROR ReferenceError: localStorage is not defined
at tokenNotExpired (e:OpPISWebtrunkClientdistmain-server.js:51257:24)
This is from angular2-jwt.
My entire app is under login, so I really don't need server rendering, because SEO is not my problem. I was just trying to help, but never though to check visual studio output window.
Ah yes angular2-jwt doesn't work on the server, I believe that's an open issue for them as they're just accessing localStorage without even checking for its existence yet.
You can disable SSR fairly easily just by commenting out code in HomeController, just leave it as return View();, and instead of ViewData["SpaHtml"] in your Home/Index.cshtml, change it to <app></app> instead.
That should give you only CSR (client-side rendering) 馃憤
I am trying to use the Angular 4 oriented SPA template from the Microsoft SPA template. I generated the template using "dotnet new angular --name [project name]". Everything was working fine until I started trying to use JWT for authentication in a manor that was successful for me when I was using the Angular2 ASP.NET Core starter kit that I found on a blog. I've implemented MarkPieszak's last suggest by removing the server side prerendering via <app></app> replacement. I was able to get the project to run again but now it is not displaying the CSS bootstrap stuff correctly. More specifically, the hover colors on the NavBar aren't working. I can't say I understand the server-side prerendering enough to troubleshoot the problem.
Here are the nuget packages I am using from the *.cproj file:
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="1.1.2" />
<PackageReference Include="microsoft.aspnetcore.identity.entityframeworkcore" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="5.1.4" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.1.4" />
I think that it is time for somebody from Microsoft to produce a template that has the Angular SPA, and the individual account authorization baked in together so the "rest of us" can start producing useful and productive projects for our clients. The time that I've wasted on trying to figure out all of this is a fine example of the downside of Microsoft's new open source agendas.
this is not a good way to treat errors
each problem in agular show itself as time out error
how do i can see the real error?
i created a new service but i got this errror and i cant understand whats the real problem
Do you have the node console up to see what the error is itself?
Let me know. @yeganehaym
Usually NodeServices is able to bubble up the error, but sometimes it gets caught in there somehow.
yeah,thanks
i saw the console
real errors are show there
Excellent! Hopefully someday we'll try to get NodeServices to bubble them up all the way to the browser. I think it just gets lost in error limbo somewhere and outputs there for now
I have the same problem. I created a Angluar 4 + ASP.NET Web core 2 project on VS2017 and it works fine on a machine where it is created. But when the repo is cloned on another machine and app is started I get this error. I tried on one more machine and it is the same error. @MarkPieszak
as Mark said. to try to see vs output window
set combox box on Asp.net core Web to see real errors
What version of Node and aspnet core are on the other one?
Any errors from npm run build:dev ?
I am getting the same error when bringing down the project from repository. NPM run build:dev works fine. Please advise.
Additional information: Node version: 7.10.0, npm version 4.2.0
did anyone find solution for this, I am facing the same problem. @milanm
@milanm@MarkPieszak even i am facing the same issue.. any resolution any one find it out
In My case resolution was (windows machine):
Node command was already registered for exe present @ "C:Program FilesMicrosoft HPC Pack 2012Bin".
I renamed this command and then Node command from cmd was diverted to NODE js properly.
Now SPA template runs fines on machine.
I had this at one point, mine was due to my login being weird on my computer, so it was fixed by simply restarting my machine... If you've tried a restart, try uninstalling all node related stuff from your pc, restart, use CCleaner to clean registry and all the junk/temp crap, then restart AGAIN, THEN reinstall all the node stuff.
I had this issue. And after 2 days of struggling I realized it was a network monitoring tool on my machine that caused this.
In my case it was WireShark. I uninstalled it. And now everything is running smoothly
Most helpful comment
I am trying to use the Angular 4 oriented SPA template from the Microsoft SPA template. I generated the template using "dotnet new angular --name [project name]". Everything was working fine until I started trying to use JWT for authentication in a manor that was successful for me when I was using the Angular2 ASP.NET Core starter kit that I found on a blog. I've implemented MarkPieszak's last suggest by removing the server side prerendering via
<app></app>replacement. I was able to get the project to run again but now it is not displaying the CSS bootstrap stuff correctly. More specifically, the hover colors on the NavBar aren't working. I can't say I understand the server-side prerendering enough to troubleshoot the problem.Here are the nuget packages I am using from the *.cproj file:
I think that it is time for somebody from Microsoft to produce a template that has the Angular SPA, and the individual account authorization baked in together so the "rest of us" can start producing useful and productive projects for our clients. The time that I've wasted on trying to figure out all of this is a fine example of the downside of Microsoft's new open source agendas.