0

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

error is start.cs

Inner Exception

docker file

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

node path

San Jaisy
  • 15,327
  • 34
  • 171
  • 290
  • 1
    Is node available on that path as shown in the error message? – Matt Ward May 24 '18 at 09:50
  • yes the node is available on that path please find the screen shot – San Jaisy May 24 '18 at 10:00
  • Does it work if you run the Angular project from the command line using `dotnet path/to/your/assembly.dll`? – Matt Ward May 24 '18 at 13:02
  • yes it work when I run the command - "dotnet run" – San Jaisy May 25 '18 at 01:44
  • What is the full path to node on your machine? VS Mac has a different PATH when compared to running dotnet from the command line. Just wondering if that is the problem here, or something else. – Matt Ward May 25 '18 at 11:10
  • So you are running the angular project on docker? Does the docker container not have node installed? – Matt Ward May 28 '18 at 11:22
  • Yes I, am running angular project on docker. I don't know the node is install in it or not. Can you please let me know the steps to install node on docker – San Jaisy May 30 '18 at 01:31
  • Not able to solve the error. here is the git link can you please let me know how can I solve this.https://github.com/anandjaisy/testapplication – San Jaisy May 31 '18 at 14:13

1 Answers1

0

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"]
San Jaisy
  • 15,327
  • 34
  • 171
  • 290