Reputation: 516
i'm using yo generator-aspnetcore-spa
once i run the app i got problem
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__13.MoveNext()
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.
and red color on this line
AspNetCore._Views_Home_Index_cshtml+d__31.MoveNext() in Index.cshtml + ViewData["Title"] = "Home Page";
this is how my package.json look like
{
"name": "WebApplicationBasic",
"version": "0.0.0",
"dependencies": {
"@angular/animations": "^4.3.0",
"@angular/common": "^4.3.0",
"@angular/compiler": "^4.3.0",
"@angular/core": "^4.3.0",
"@angular/forms": "^4.3.0",
"@angular/http": "^4.3.0",
"@angular/platform-browser": "^4.3.0",
"@angular/platform-browser-dynamic": "^4.3.0",
"@angular/platform-server": "^4.3.0",
"@angular/router": "^4.3.0",
"@types/node": "^7.0.38",
"angular2-template-loader": "^0.6.2",
"aspnet-prerendering": "^2.0.6",
"aspnet-webpack": "^1.0.29",
"awesome-typescript-loader": "^3.2.1",
"bootstrap": "^3.3.7",
"css": "^2.2.1",
"css-loader": "^0.28.4",
"es6-shim": "^0.35.3",
"event-source-polyfill": "0.0.9",
"expose-loader": "^0.7.3",
"extract-text-webpack-plugin": "^2.1.2",
"file-loader": "^0.11.2",
"html-loader": "^0.4.5",
"isomorphic-fetch": "^2.2.1",
"jquery": "^3.2.1",
"json-loader": "^0.5.4",
"ng-snotify": "^2.0.3",
"ngx-cookie": "^1.0.0",
"preboot": "^4.5.2",
"raw-loader": "^0.5.1",
"reflect-metadata": "^0.1.10",
"rxjs": "^5.4.2",
"style-loader": "^0.17.0",
"to-string-loader": "^1.1.5",
"typescript": "^2.4.1",
"url-loader": "^0.5.9",
"webpack": "^2.7.0",
"webpack-hot-middleware": "^2.18.2",
"webpack-merge": "^4.1.0",
"zone.js": "^0.8.14"
}
}
my app was work fine and i don't no what is the reason of this problem
Upvotes: 3
Views: 7973
Reputation: 73
We host our site in Azure and the solution for me was to add this config key/value to the Application settings.
Key: WEBSITE_NODE_DEFAULT_VERSION
Value: 6.9.1
I suppose you could also add it to your appsetting.json or web.config as well.
Upvotes: 6
Reputation: 49311
Not exactly an answer to this question, but I had the same issue and came here.
I have Windows HPC pack installed, and that means the node.exe on my PATH was the Windows HPC node command rather than the third-party NodeJS node.exe
This meant I got the timeout as it was running the HPC node command instead of using NodeJS to run webpack. To fix, I removed the path from the PATH environment variable and restarted Visual Studio. I could have reordered the paths, or renamed one of the node.exe, but I don't use the HPC commands from the command line, only from code.
Discussion of the conflict in NodeJS https://github.com/nodejs/node-v0.x-archive/issues/7773
Upvotes: 0
Reputation: 452
I had the same problem. It might be an issue with the local version of node.
I set my local nodejs version to 5.4.3 and was able to get the app running, try checking your node version using this on your console/terminal:
node -v
I think removing the prerendering tag then running webpack might still be excluding that module from server-side prerendering, so hopefully a newer node version can help run the app as expected without code changes.
Also there's a similar issue here : NodeInvocationException: Attempt to connect to Node timed out
Upvotes: 2
Reputation: 516
The problem was in aspnet-prerendering module it looks like this in View>>Home>>Index.csHtml
<app asp-prerender-module="ClientApp/dist/main-server">Loading...</app>
Then when i removed it the app works fine
<app>Loading...</app>
but there is no server-side rendering of course by this so when i finished from developing the app i write this command in root directory of my project
webpack --config webpack.config.vendor.js
webpack
and restored the
<app asp-prerender-module="ClientApp/dist/main-server">Loading...</app>
and it works as it should be :)
Upvotes: 5