simbada
simbada

Reputation: 980

How do i solve 'Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException'

I have just created new ASP.NET Core Web Application using predefined templates e.g `File > New > Project > Asp.Net Core Web Application'.

I select .NET Core 2.0 with Angular template. I am using VS 2017. The node version installed on my machine is 4.2.2 NPM version is 2.14.7

When i run i get exception

{Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException: Unexpected token { SyntaxError: Unexpected token { at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:414:25) at Object.Module._extensions..js (module.js:442:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:311:12) at Module.require (module.js:366:17) at require (module.js:385:17) at Object. (c:\users\MyApp\node_modules\@ngtools\webpack\src\index.js:30:10) at Module._compile (module.js:435:26) at Object.Module._extensions..js (module.js:442:10) at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.d__71.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.d__131.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.d__101.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.<InvokeExportWithPossibleRetryAsync>d__101.MoveNext()}

Upvotes: 0

Views: 2240

Answers (1)

TheKingPinMirza
TheKingPinMirza

Reputation: 8912

The reason i see for this problem is basically you are using older versions of Node and NPM. Like you said "The node version installed on my machine is 4.2.2 NPM version is 2.14.7"

You need to update them Node: 6.11.2 NPM: 3.10.10.

Then problem shall be fixed.

Upvotes: 3

Related Questions