How can I install package from private repository using docker

为君一笑 提交于 2020-08-20 11:20:52

问题


I am installing a package from my private repository. I am able to install it using: npm i -S git+https://oauth2:XXXXXXX@gitlab.com/mygroup/acl-api.git

I am using docker container but while installation process I am getting an error:

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

How can I solve it?

My docker file:

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"]

回答1:


You should add git and openssh-client and other packages if you want to the node:alpine to let npm pull the repository

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"]


来源:https://stackoverflow.com/questions/62712426/npm-warn-deprecated-on-node-v14

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!