Launching the SPA proxy…
Error on Docker logs:
fail: Microsoft.AspNetCore.SpaProxy.SpaProxyLaunchManager[0]
Failed to launch the SPA development server ‘npm run start’.
System.ComponentModel.Win32Exception (2): An error occurred trying to start process ‘/usr/local/bin/npm’ with working directory ‘/app/bin/Debug/net6.0/C:reposDMMRuntimeCoreDmmServiceClientApp’. 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.SpaProxy.SpaProxyLaunchManager.LaunchDevelopmentProxy()
app.UseSpa(spa =>
{
spa.Options.SourcePath = Path.Join(builder.Environment.ContentRootPath, "ClientApp");
//spa.Options.SourcePath = _spaRoot;
});
Docker file that installs node
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
RUN apt-get update
RUN apt-get install -y curl
RUN apt-get install -y libpng-dev libjpeg-dev curl libxi6 build-essential libgl1-mesa-glx
RUN curl -sL https://deb.nodesource.com/setup_lts.x | bash -
RUN apt-get install -y nodejs
csproj settings for SpaProxy
<SpaRoot>ClientApp</SpaRoot>
<ImplicitUsings>disable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules**</DefaultItemExcludes>
<SpaProxyServerUrl>http://localhost:44405</SpaProxyServerUrl>
<SpaProxyLaunchCommand>npm run start</SpaProxyLaunchCommand>
vite.config.js
export default defineConfig({
resolve: {
alias: {
process: "process/browser",
stream: "stream-browserify",
zlib: "browserify-zlib",
util: 'util'
}
},
server: {
proxy: {
//private routing
},
host: true,
port: 44405
},
build: {
outDir: 'build',
emptyOutDir: true
},
plugins: [
plugin()
]
})
I tried to change UseSpa configurations. I tried to change node installation to multistaged one. I tried to change vite.config.js. But no luck until now.