gpt4 book ai didi

asp.net - Docker中带有JavaScriptServices的ASP.NET Core项目无法启动节点

转载 作者:行者123 更新时间:2023-12-02 19:34:26 27 4
gpt4 key购买 nike

我在使站点在Docker容器中正常运行时遇到问题。该容器可以很好地构建并运行,但是在导航到页面时,它无法加载JavaScript服务。

这是Dockerfile

FROM microsoft/aspnetcore-build:2.0 AS builder
WORKDIR /app

ADD company_cas.pem /usr/local/share/ca-certificates/company_cas.crt
RUN update-ca-certificates

COPY company_cas.pem ./
RUN npm config set cafile company_cas.pem

# Run NPM install for dependencies
COPY package.json ./
RUN npm install

# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore

# Copy everything else and build
COPY . ./

RUN dotnet publish -c Release -o out

# Build runtime image
FROM microsoft/aspnetcore:2.0
WORKDIR /app
COPY --from=builder /app/out .
ENTRYPOINT ["dotnet", "web.dll"]

我正在使用 microsoft/aspnetcore-build:2.0基本镜像,并且npm确实在运行,因此,据我所知,Node已安装。

失败请求的输出是-
fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0]
web | An unhandled exception has occurred: Failed to start Node process. To resolve this:.
web |
web | [1] Ensure that Node.js is installed and can be found in one of the PATH directories.
web | Current PATH enviroment variable is: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
web | Make sure the Node executable is in one of those directories, or update your PATH.
web |
web | [2] See the InnerException for further details of the cause.
web | System.InvalidOperationException: Failed to start Node process. To resolve this:.
web |
web | [1] Ensure that Node.js is installed and can be found in one of the PATH directories.
web | Current PATH enviroment variable is: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
web | Make sure the Node executable is in one of those directories, or update your PATH.
web |
web | [2] See the InnerException for further details of the cause. ---> System.ComponentModel.Win32Exception: No such file or directory

Full Error Stack @ Pastebin

这是为ASP.NET设置新路径来查找Node的问题吗?如果是这样,对在Docker中应该使用的路径有什么想法吗?

最佳答案

我想我忽略了运行时镜像基础容器。

更改为FROM microsoft/aspnetcore-build:2.0,现在很好。

关于asp.net - Docker中带有JavaScriptServices的ASP.NET Core项目无法启动节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47353885/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com