0

我正在尝试使用此 docker 文件运行 Angular 应用程序容器:

# stage 1
FROM node:alpine AS my-app-build
WORKDIR /app
COPY . .
RUN npm install @openapitools/openapi-generator-cli -g
RUN npm run build

# stage 2
FROM nginx:alpine
COPY --from=my-app-build /app/dist/ /usr/share/nginx/html
EXPOSE 80

我需要 openapitools 来生成我的客户端 api,但我收到以下错误消息:

/usr/local/lib/node_modules/@openapitools/openapi-generator-cli/main.js:636
                error ? reject(new Error(stderr)) : resolve(stdout);
                               ^

Error: /bin/sh: java: not found

    at /usr/local/lib/node_modules/@openapitools/openapi-generator-cli/main.js:636:32
    at ChildProcess.exithandler (node:child_process:404:5)
    at ChildProcess.emit (node:events:390:28)
    at maybeClose (node:internal/child_process:1062:16)
    at Socket.<anonymous> (node:internal/child_process:448:11)
    at Socket.emit (node:events:390:28)
    at Pipe.<anonymous> (node:net:687:12)

Node.js v17.3.1
Error response from daemon: The command '/bin/sh -c npm run build' returned a non-zero code: 1

为什么我需要java?我必须安装它吗?

4

1 回答 1

1

是的,您需要安装 java,或者使用另一个 openapi 生成器。

对于一个角度项目,我使用ng-openapi-gen。这个不需要,可能还有其他的。

于 2022-01-18T18:53:42.397 回答