尝试npm安装时,出现错误:
1206 error node v0.12.0
1207 error npm v2.7.4
1208 error code 128
1209 error Command failed: git clone --template=/root/.npm/_git-remotes/_templates --mirror ssh://git@git.spindle.factfiber.com/schematist-postgres.git /root/.npm/_git-remotes/ssh-git-git-spindle-factfiber-com-schematist-postgres-git-8e4b2071
1209 error ssh: Could not resolve hostname git.spindle.factfiber.com: Name or service not known
但是,当我尝试从shell报告的命令时:
git clone --template=/root/.npm/_git-remotes/_templates --mirror ssh://git@git.spindle.factfiber.com/schematist-postgres.git /root/.npm/_git-remotes/ssh-git-git-spindle-factfiber-com-schematist-postgres-git-8e4b2071
有效:
Cloning into bare repository '/root/.npm/_git-remotes/ssh-git-git-spindle-factfiber-com-schematist-postgres-git-8e4b2071'...
remote: Counting objects: 47, done.
remote: Compressing objects: 100% (39/39), done.
remote: Total 47 (delta 20), reused 0 (delta 0)
Receiving objects: 100% (47/47), 13.05 KiB, done.
Resolving deltas: 100% (20/20), done.
我尝试了几次以防它是一个临时dns故障。有谁知道会发生什么?
更新:当我创建新的回购和
时npm install git+ssh://git@git.spindle.factfiber.com:schematist-postgres.git
然后一旦失败,第二次成功。无论哪种方式,npm需要很长时间(20-30秒?),而shell git
只需要一秒钟。
这是一个码头图片,顺便说一下。我决定在一个图像(屏幕,jove)和重建之前投入一些命令行工具 - 在它建好之前,但仍然需要很长时间。所以我不认为只包括那些包是问题所在。问题可能是某些DNS配置错误?但是,如果是这样,为什么npm具体?
更新 - Dockerfile。这是基于mac / yosemite构建的
FROM debian:wheezy
RUN DEBIAN_FRONTEND=noninteractive apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y curl wget \
openssh-client build-essential unicode-data screen jove
# ------------------------------------------------
# node
RUN curl -sL https://deb.nodesource.com/setup_0.12 | bash -
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs
RUN npm install -g coffee-script && npm -g install npm@latest
# ------------------------------------------------
# git
# setup keys so we can pull from github
# mounted "sw-pull-rsa" contains key
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y git
ADD ./sw-pull-rsa /root/.ssh/id_rsa
ADD ./sw-pull-rsa.pub /root/.ssh/id_rsa.pub
RUN chmod 0600 /root/.ssh/id_rsa
RUN ssh-keyscan github.com >> /root/.ssh/known_hosts
RUN ssh-keyscan git.spindle.factfiber.com >> /root/.ssh/known_hosts
# ------------------------------------------------
RUN npm install -g npm
RUN npm install -g npm-cache
RUN mkdir -p /tmp/common
COPY ./common/package.json /tmp/common/
RUN cd /tmp/common && npm install
答案 0 :(得分:1)
跟进@ user2915097 - 在每个安装之前放置一个apt-get update
。我想也许git版本和npm版本在某种程度上不兼容。