ASP.NET核心系统找不到指定的文件

ASP.NET Core The system cannot find the file specified

我已按照 this 教程将 angular 和 ASP.NET 核心 运行 结合在一起。初始构建工作正常,但在更新 angular 包后,我在应用程序启动时收到以下错误(我还必须在此过程中重新安装 nodejs,不确定这是否相关):

错误在以下行:

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

错误本身并没有为我提供任何有用的信息来追踪问题。

我得到一个:

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

在 InnerExceptions 下,它列出了以下错误:

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()}

如果有人能指出我从错误中获取更多信息的方向,将会有所帮助。

好像找不到node.exe。第一次安装 Node 后,我看到了同样的错误。这是因为安装 Node 修改了系统路径,而新路径没有被 IIS 获取。我必须重新启动我的服务器,然后它才能找到节点 exe。

检查您是否安装了最新的 NPM。这解决了我的问题。