ASP.NET Core The system cannot find the file specified

早过忘川 提交于 2019-12-23 15:50:21

问题


I have followed this tutorial on getting angular and ASP.NET Core running together. The initial build worked fine but after updating angular packages I am receiving the following error on startup of the application(I also had to reinstall nodejs in the process, not sure if this is related):

The error is on the following line:

app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions {
    HotModuleReplacement = true
});

The error itself does not provide me with any usefull information to track down the issue.

I get a:

System.AggregateException => Count = error CS0103: The name 'InnerExceptionCount' does not exist in the current context

Under InnerExceptions it lists the following error:

System.ComponentModel.Win32Exception: The system cannot find the file specified at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at System.Diagnostics.Process.Start(ProcessStartInfo startInfo) at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.LaunchNodeProcess(ProcessStartInfo startInfo) at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance..ctor(String entryPointScript, String projectPath, String[] watchFileExtensions, String commandLineArguments, ILogger nodeOutputLogger, IDictionary2 environmentVars, Int32 invocationTimeoutMilliseconds, Boolean launchWithDebugging, Int32 debuggingPort) at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance..ctor(String projectPath, String[] watchFileExtensions, ILogger nodeInstanceOutputLogger, IDictionary2 environmentVars, Int32 invocationTimeoutMilliseconds, Boolean launchWithDebugging, Int32 debuggingPort, Int32 port) at Microsoft.AspNetCore.NodeServices.NodeServicesFactory.CreateNodeInstance(NodeServicesOptions options) at Microsoft.AspNetCore.NodeServices.NodeServicesFactory.<>c__DisplayClass0_0.b__0() at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.CreateNewNodeInstance() at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.GetOrCreateCurrentNodeInstance() at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.d__10`1.MoveNext()}

If someone can point me in the direction to get more information from the Error would be helpful.


回答1:


It looks like it is unable to find node.exe. I saw the same error after installing Node for the first time. It was because installing Node modified the system Path and the new Path wasn't getting picked up by IIS. I had to reboot my server and it was then able to find the node exe.




回答2:


Check if you have the latest NPM installed. This solved my problem.



来源:https://stackoverflow.com/questions/41244137/asp-net-core-the-system-cannot-find-the-file-specified

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!