Node.js Docker NPM安装时出现奇怪的Git错误
我有一个正在工作的Dockerfile,直到一天前,它似乎突然坏了。我没有对我的依赖项进行任何更改-但我收到以下错误:Node.js Docker NPM安装时出现奇怪的Git错误,node.js,git,docker,dockerfile,npm-install,Node.js,Git,Docker,Dockerfile,Npm Install,我有一个正在工作的Dockerfile,直到一天前,它似乎突然坏了。我没有对我的依赖项进行任何更改-但我收到以下错误: [91mnpm ERR! code ENOGIT [0m [91mnpm ERR! No git binary found in $PATH npm ERR! npm[0m [91m ERR! Failed using git. npm ERR! Please check if you have git installed and in your PATH. [0m [91m
[91mnpm ERR! code ENOGIT
[0m
[91mnpm ERR! No git binary found in $PATH
npm ERR!
npm[0m
[91m ERR! Failed using git.
npm ERR! Please check if you have git installed and in your PATH.
[0m
[91m
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-09-28T21_12_50_050Z-debug.log
[0m
Removing intermediate container be9d5bfe5521
The command '/bin/sh -c npm install' returned a non-zero code: 1
这太奇怪了,因为这以前从未发生过。我还附上了我的Dockerfile。到目前为止,我一直在尝试添加git(第三行),并尝试导出路径。似乎什么都没用
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y git
FROM node:alpine
RUN npm install sails -g
#RUN npm install git -g
#RUN export PATH="$HOME/usr/bin/git:$PATH"
RUN mkdir -p /service/app
WORKDIR /service/app
COPY package.json /service/app
RUN npm install
COPY . /service/app
EXPOSE 80
CMD NODE_ENV=production sails lift
其中一个原因可能是您在
Dockerfile
中使用了精简版的node:
来自节点:8-slim
我认为这不包括git,因为当我更改为完整版本时,错误消失了:
从节点:8.11.2
尝试以下操作:
RUN apk update && \
apk add --update git && \
apk add --update openssh
docker容器中的git二进制文件在docker文件顶部的
/usr/bin/git
添加ENV NODE\u DEBUG=fs、module、http、https
处可用。这将显示大量日志,但您可能会掌握实际的日志issue@aamirl你能解决这个问题吗?