Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

WebPSA error when deploying linux-dev - (Failed to start 'npm') #1983

Closed
kbeaugrand opened this issue Sep 26, 2022 · 9 comments
Closed

WebPSA error when deploying linux-dev - (Failed to start 'npm') #1983

kbeaugrand opened this issue Sep 26, 2022 · 9 comments

Comments

@kbeaugrand
Copy link

Hi,

I've an issue when using WebSPA and deploying the linux-dev image.
WebSPA container starts but is unable to process requests since npm seems to not beeing installed on the container:

AggregateException: One or more errors occurred. (Failed to start 'npm'. To resolve this:.

[1] Ensure that 'npm' is installed and can be found in one of the PATH directories.
Current PATH enviroment variable is: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Make sure the executable is in one of those directories, or update your PATH.

Regarding the Dokerfile code, it seems to be normal because the image uses aspnet:6.0 which does not contain nodejs or npm.

@kbeaugrand
Copy link
Author

By looking in the helm chart for the WebSPA service, it seems that it has been kept on Development environment.

I think it should be

    - name: ASPNETCORE_ENVIRONMENT
      value: Production

What do you think about that ?

@kbeaugrand kbeaugrand changed the title WebPSA erro when deploying linux-dev - (Failed to start 'npm') WebPSA error when deploying linux-dev - (Failed to start 'npm') Sep 26, 2022
kbeaugrand added a commit to DemoServiceMesh/eShopOnContainers that referenced this issue Sep 26, 2022
@erjain
Copy link
Contributor

erjain commented Sep 26, 2022

Hi, thanks for testing eShop and posting here. I have tested it completely using public images
.\deploy-all.ps1 -imageTag linux-dev -useLocalk8s $true
and it is working for me. Just for testing, are you able to run it using docker-compose?
Can you share any other logs?
For more information on Deploy to Local k8s, please refer to the wiki page: https://github.com/dotnet-architecture/eShopOnContainers/wiki/Deploy-to-Local-Kubernetes.
I hope it helps, feel free to continue the conversation in case of more queries.

@kbeaugrand
Copy link
Author

@erjain ,

My bad, I made a mistake in the issue details.
I'm using custom image, built by docker-compose from the dev branch. The I was deploying with deploy-all.ps1 script.

@erjain
Copy link
Contributor

erjain commented Sep 27, 2022

Hi @kbeaugrand, Can you share any logs?

@kbeaugrand
Copy link
Author

Sure, here are the logs when deploying with ASPNETCORE_ENVIRONMENT set to Development :

System.AggregateException: One or more errors occurred. (Failed to start 'npm'. To resolve this:.

[1] Ensure that 'npm' is installed and can be found in one of the PATH directories.
    Current PATH enviroment variable is: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    Make sure the executable is in one of those directories, or update your PATH.

[2] See the InnerException for further details of the cause.)
 ---> System.InvalidOperationException: Failed to start 'npm'. To resolve this:.

[1] Ensure that 'npm' is installed and can be found in one of the PATH directories.
    Current PATH enviroment variable is: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    Make sure the executable is in one of those directories, or update your PATH.

[2] See the InnerException for further details of the cause.
 ---> System.ComponentModel.Win32Exception (2): An error occurred trying to start process 'npm' with working directory 'Client'. No such file or directory
   at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at Microsoft.AspNetCore.NodeServices.Npm.NodeScriptRunner.LaunchNodeProcess(ProcessStartInfo startInfo, String commandName)
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.NodeServices.Npm.NodeScriptRunner.LaunchNodeProcess(ProcessStartInfo startInfo, String commandName)
   at Microsoft.AspNetCore.NodeServices.Npm.NodeScriptRunner..ctor(String workingDirectory, String scriptName, String arguments, IDictionary`2 envVars, String pkgManagerCommand, DiagnosticSource diagnosticSource, CancellationToken applicationStoppingToken)
   at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(String sourcePath, String scriptName, String pkgManagerCommand, Int32 portNumber, ILogger logger, DiagnosticSource diagnosticSource, CancellationToken applicationStoppingToken)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Microsoft.AspNetCore.SpaServices.Extensions.Util.TaskTimeoutExtensions.WithTimeout[T](Task`1 task, TimeSpan timeoutDelay, String message)
   at Microsoft.AspNetCore.SpaServices.Extensions.Proxy.SpaProxy.PerformProxyRequest(HttpContext context, HttpClient httpClient, Task`1 baseUriTask, CancellationToken applicationStoppingToken, Boolean proxy404s)
   at Microsoft.AspNetCore.Builder.SpaProxyingExtensions.<>c__DisplayClass2_0.<<UseProxyToSpaDevelopmentServer>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

@erjain
Copy link
Contributor

erjain commented Sep 29, 2022

It seems to be some system-specific temporary error, basically, it's not able to find npm, are you able to run it on your machine when the value is updated to production?

value: Production

@kbeaugrand
Copy link
Author

kbeaugrand commented Oct 1, 2022

Yes, it works when specifying to production.
That was the reason I created the PR #1984

@erjain
Copy link
Contributor

erjain commented Oct 3, 2022

Thanks for the PR @kbeaugrand, I suggest keeping the value as it is and later we will update the documentation and keep this issue for the reference of community users, in case of a similar issue users can refer to it. I am closing this issue now, please feel free to reopen it in case of further queries.

@erjain erjain closed this as completed Oct 3, 2022
@ferantoMSFT
Copy link

This issue just happened to me, changing the value in the helm chart fixed it. But I didnt see any references to documentation here https://github.com/dotnet-architecture/eShopOnContainers/wiki/Deploy-to-Azure-Kubernetes-Service-(AKS). Do you still plan to update the docs or would it be better to update the helm chart itself?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants