我刚刚使用预定义的模板创建了新的ASP.NET Core Web Application
,例如`File>新>项目> Asp.Net核心Web应用程序'。
我使用Angular模板选择.NET Core 2.0
。
我正在使用VS 2017。
我的计算机上安装的节点版本为4.2.2
NPM版本为2.14.7
当我跑步时我得到异常
{Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException: 意外的令牌{SyntaxError:意外的令牌{ 在exports.runInThisContext(vm.js:53:16) 在Module._compile(module.js:414:25) at Object.Module._extensions..js(module.js:442:10) 在Module.load(module.js:356:32) 在Function.Module._load(module.js:311:12) 在Module.require(module.js:366:17) at require(module.js:385:17) 在对象。 (C:\用户\ MyApp的\ node_modules \ @ngtools \的WebPack \ SRC \ index.js:30:10) 在Module._compile(module.js:435:26) 在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
的Object.Module._extensions..js(module.js:442:10)1.GetResult() 在 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.TaskAwaiter
1.GetResult() 在 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__10
1.MoveNext()}
答案 0 :(得分:3)
我看到这个问题的原因基本上是你使用旧版本的Node和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.
然后问题应该解决。