gpt4 book ai didi

node.js - Dockerize框架测试 "Failed to exec"

转载 作者:太空宇宙 更新时间:2023-11-04 00:16:50 26 4
gpt4 key购买 nike

我想对 galenframework 测试进行 dockerize。这是我目前拥有的:

Docker 文件

FROM node:8.6
RUN mkdir -p /usr/src/galen
WORKDIR /usr/src/galen
COPY package.json /usr/src/galen/
RUN npm install
COPY . /usr/src/galen

docker-compose.yml

version: '2'
services:
galenframework:
build:
context: .
dockerfile: Dockerfile
volumes:
- .:/usr/src/galen

package.json

{
"name": "docker_galen",
"version": "1.0.0",
"description": "Node.js on Docker with Galen",
"dependencies": {
"galenframework-cli": "2.3.5"
}
}

运行docker-compose up -d后出现以下错误:

info Install exited unexpectedly npm info lifecycle galenframework-cli@2.3.5~postinstall: Failed to exec postinstall script npm WARN docker_galen@1.0.0 No repository field. npm WARN docker_galen@1.0.0 No license field. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! galenframework-cli@2.3.5 postinstall: node postinstall.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the galenframework-cli@2.3.5 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

我该如何解决这个问题?

最佳答案

您需要 Java 来运行 Galen,所以这应该可以工作

FROM java:8

ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 6.11.4
ENV GALEN_VERSION 2.3.5

# Install nvm with node and npm
RUN curl https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash \
&& . $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default \
&& npm install -g galenframework-cli@$GALEN_VERSION

ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/v$NODE_VERSION/bin:$PATH

关于node.js - Dockerize框架测试 "Failed to exec",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46545434/

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