npm安装在编译dockerfile上失败

时间:2020-08-31 14:11:17

标签: docker npm svelte

我有我的dockerfile:

FROM node:14-alpine
 
WORKDIR /usr/src/app
 
COPY rollup.config.js ./
COPY package.json ./
 
RUN npm install
 
COPY ./src ./src
COPY ./static ./static
 
RUN npm run-script build
 
EXPOSE 4000
 
ENV HOST=0.0.0.0
 
CMD [ "npm", "start" ]

我执行时

docker build -t Dockerfile .

我有此错误:

npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno -2
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t http://username:password@192.168.0.117:3000/username/example-component.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 

因为我的package.json上的某些软件包是

"package":  "git+http://username:password@192.168.0.117:3000/username/example-component.git",

只能通过vpn访问。当我执行docker build时,我处于vpn下,我不明白为什么无法访问

0 个答案:

没有答案