npm ERR!写完以后。在docker中运行RUN NPM安装失败,AWS

时间:2018-07-29 23:48:29

标签: node.js docker npm

尝试运行docker build -t app . --memory 3G --memory-swap 4G时遇到了

 Step 8/11 : RUN npm install
 ---> Running in 5283e1139345
    npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
    npm WARN deprecated fs-promise@2.0.3: Use mz or fs-extra^3.0 with Promise Support
    npm WARN deprecated tar.gz@1.0.7: ⚠️  WARNING ⚠️ tar.gz module has been deprecated and your application is vulnerable. Please use tar module instead: https://npmjs.com/tar
    npm ERR! write after end

有人知道导致此错误的原因吗?为什么npm没有安装?我将AWS与Docker结合使用。

Dockerfile如下所示

FROM ubuntu:18.04

WORKDIR /app
COPY . .

# If you have native dependencies, you'll need extra tools
# RUN apk add --no-cache make gcc g++ python
RUN apt-get update \
  && apt-get install -y --no-install-recommends apt-utils -y \
  && apt-get install curl -y \
  && apt-get install git-core -y \
  && curl -sL https://deb.nodesource.com/setup_8.x \
  && apt-get install -y nodejs npm \
  && curl https://cmake.org/files/v3.11/cmake-3.11.3-Linux-x86_64.sh -o /tmp/curl-install.sh \
  && chmod u+x /tmp/curl-install.sh \
  && mkdir /usr/bin/cmake \
  && /tmp/curl-install.sh --skip-license --prefix=/usr/bin/cmake \
  && rm /tmp/curl-install.sh \
  && apt-get install libpq-dev -y \
  && apt-get install libboost-all-dev -y \
  && apt-get install postgresql-server-dev-all -y

ENV PATH="/usr/bin/cmake/bin:${PATH}"

RUN npm install -g npm@5

RUN ./move-cpp-files.sh
RUN npm install
RUN npm run compile

EXPOSE 3000
CMD ["npm", "start"]

1 个答案:

答案 0 :(得分:2)

您可能正在安装had this problem的NPM版本:

RUN npm install -g npm@5

尝试不使用该行,还是有特定原因?