Error: /bin/sh: java: not found with @openapitools
Error: /bin/sh: java: not found with @openapitools
我正在尝试 运行 一个 Angular 应用容器与这个 docker 文件:
# 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?
我必须安装它吗?
是的,您需要安装 java,或使用另一个 openapi 生成器。
对于 angular 项目,我使用 ng-openapi-gen。这个不需要,估计还有其他的。
我正在尝试 运行 一个 Angular 应用容器与这个 docker 文件:
# 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? 我必须安装它吗?
是的,您需要安装 java,或使用另一个 openapi 生成器。
对于 angular 项目,我使用 ng-openapi-gen。这个不需要,估计还有其他的。