2017-08-31 48 views
0

我剛剛創造了新的ASP.NET Core Web Application使用預定義模板e.g`文件>新建>項目> Asp.Net核心Web應用程序」。我如何解決「Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException」

我選擇.NET Core 2.0有角模板。 我使用VS 2017 安裝在我的機器上的節點版本是4.2.2 NPM版本2.14.7

當我跑我得到異常

{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__7 1.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.TaskAwaiter 1.GetResult() at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.d__13 1.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.TaskAwaiter 1.GetResult() at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.d__10 1.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__10 1.MoveNext()}

回答

2

的原因我看這個問題基本上是你使用舊版本的節點和NPM。就像你說的"The node version installed on my machine is 4.2.2 NPM version is 2.14.7"

您需要更新他們 Node: 6.11.2 NPM: 3.10.10.

然後問題應固定。

+0

OK還是讓我檢查! – simbada

+0

是的,謝謝它在我升級了我的Node和Npm版本後工作。 – simbada