System Aggregation Exception : Failed to start Node Process

帅比萌擦擦* 提交于 2020-01-06 06:55:20

问题


I, have create a angular app in mac os using vs2017 and followed the sample form Creating a new Angular project on Mac with Visual Studio with docker support for three project. Since the other project are Web API. Since the other project are successfully running on the docker. However only the angular app is not running and it throw an error as below

System.AggregateException: "One or more errors occurred. (Failed to start Node process. To resolve this:.\n\n[1] Ensure that Node.js is installed and can be found in one of the PATH directories.\n    Current PATH enviroment variable is: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n    Make sure the Node executable is in one of those directories, or update your PATH.\n\n[2] See the InnerException for further details of the cause.)" ---> System.Exception {System.InvalidOperationException}: "Failed to start Node process. To resolve this:.\n\n[1] Ensure that Node.js is installed and can be found in one of the PATH directories.\n    Current PATH enviroment variable is: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n    Make sure the Node executable is in one of those directories, or update your PATH.\n\n[2] See the InnerException for further details of the cause." ---> System.Exception {System.ComponentModel.Win32Exception}: "No such file or directory"
  at at System.Diagnostics.Process.ResolvePath(String filename)\n   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)\n   at System.Diagnostics.Process.Start()\n   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)\n   at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.LaunchNodeProcess(ProcessStartInfo startInfo)
  --- End of inner exception stack trace ---
  at at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.LaunchNodeProcess(ProcessStartInfo startInfo)\n   at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance..ctor(String entryPointScript, String projectPath, String[] watchFileExtensions, String commandLineArguments, CancellationToken applicationStoppingToken, ILogger nodeOutputLogger, IDictionary`2 environmentVars, Int32 invocationTimeoutMilliseconds, Boolean launchWithDebugging, Int32 debuggingPort)\n   at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance..ctor(NodeServicesOptions options, Int32 port)\n   at Microsoft.AspNetCore.NodeServices.HostingModels.NodeServicesOptionsExtensions.<>c__DisplayClass0_0.<UseHttpHosting>b__0()\n   at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.CreateNewNodeInstance()\n   at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.GetOrCreateCurrentNodeInstance()\n   at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.<InvokeExportWithPossibleRetryAsync>d__10`1.MoveNext()
  --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)\n   at Microsoft.AspNetCore.Builder.WebpackDevMiddleware.UseWebpackDevMiddleware(IApplicationBuilder appBuilder, WebpackDevMiddlewareOptions options)\n   at WebApp.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env) in /Users/macbook/Projects/MeroRental/WebApp/Startup.cs:line 34\n--- End of stack trace from previous location where exception was thrown ---\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)\n   at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder builder)\n   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()\n   at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()\n   at WebApp.Program.BuildWebHost(String[] args) in /Users/macbook/Projects/MeroRental/WebApp/Program.cs:line 21\n   at WebApp.Program.Main(String[] args) in /Users/macbook/Projects/MeroRental/WebApp/Program.cs:17

Tried to solve the error from this link https://github.com/aspnet/JavaScriptServices/issues/707 but no result.


回答1:


Found the solution from this link and it worked.

https://github.com/aspnet/JavaScriptServices/issues/1534#issuecomment-366605094

modified the angular app docker file

change this line

FROM microsoft/aspnetcore:2.0 AS base

to

FROM microsoft/aspnetcore-build:2.0 AS base

Updated Docker file

FROM microsoft/aspnetcore-build:2.0 AS base
WORKDIR /app
EXPOSE 80

FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY MeroRental.sln ./
COPY WebApp/WebApp.csproj WebApp/
RUN dotnet restore -nowarn:msb3202,nu1503
COPY . .
WORKDIR /src/WebApp
RUN dotnet build -c Release -o /app

FROM build AS publish
RUN dotnet publish -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "WebApp.dll"]


来源:https://stackoverflow.com/questions/50505974/system-aggregation-exception-failed-to-start-node-process

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