我正在从我的私有存储库安装软件包。我可以使用以下方式安装它:
npm i -S git+https://oauth2:XXXXXXX@gitlab.com/mygroup/acl-api.git
我正在使用docker容器,但是在安装过程中出现错误:
npm ERR! path git
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! syscall spawn git
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t https://oauth2:XXXXXXX@gitlab.com/mygroup/acl-api.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
我该如何解决?
我的docker文件:
FROM node:alpine
COPY package.json package.json
COPY src src
COPY .babelrc .babelrc
RUN npm install
RUN npm run gitlab-build
RUN ls
EXPOSE 8080
CMD ["npm", "run", "docker-start"]
答案 0 :(得分:2)
如果要添加到git
中,让openssh-client
提取存储库,则应添加node:alpine
和npm
及其他软件包
FROM node:alpine
RUN apk add --update \
python \
python-dev \
py-pip \
build-base \
git \
openssh-client \
&& pip install virtualenv \
&& rm -rf /var/cache/apk/*
COPY package.json package.json
COPY src src
COPY .babelrc .babelrc
RUN npm install
RUN npm run gitlab-build
RUN ls
EXPOSE 8080
CMD ["npm", "run", "docker-start"]