为什么我无法纠正问题,您拿着破损的包裹

时间:2019-05-19 07:24:08

标签: docker ubuntu

尝试运行Dockerfile,安装npm失败。

错误:

Unable to correct problems, you have held broken packages.
The command '/bin/sh -c apt-get install -y npm' returned a non-zero code: 100

Dockerfile:

FROM ubuntu:14.04

MAINTAINER Giacomo Vacca "giacomo.vacca@gmail.com"

ENV REFRESHED_AT 2015-01-19
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get autoremove
RUN npm -v

RUN apt-get update
RUN apt-get upgrade -y

RUN apt-get install --yes curl
RUN curl --silent --location http://deb.nodesource.com/setup_0.10 | sudo bash -
RUN apt-get install -y nodejs
RUN apt-get install --yes build-essential

RUN rm /usr/bin/node

# needs this to find the nodejs exec
RUN ln -s /usr/bin/nodejs /usr/bin/node

RUN apt-get install -y npm  <--- FAIL
RUN /usr/bin/npm install socket.io@0.9.14

EXPOSE 8080

ENTRYPOINT ["/usr/bin/node", "/root/server.js"]

1 个答案:

答案 0 :(得分:1)

您无需使用以下命令从ubuntu发行版中安装npm:

RUN apt-get install -y npm

因为它已经由nodesource的nodejs软件包安装了。您可以使用以下方法进行检查:

dpkg -L nodejs | grep "/usr/bin/npm"