【问题标题】:npm ERR! write after end. RUN npm install fails in docker, awsnpm 错误!结束后写。在 docker、aws 中运行 npm 安装失败
【发布时间】:2018-07-30 09:28:05
【问题描述】:

在尝试运行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"]

【问题讨论】:

    标签: node.js docker npm


    【解决方案1】:

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

    RUN npm install -g npm@5

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

    【讨论】:

    • 可能就是这样,现在就玩弄它。如果我让它工作,我会接受这个答案
    猜你喜欢
    • 1970-01-01
    • 2020-10-27
    • 2018-05-24
    • 1970-01-01
    • 1970-01-01
    • 2013-08-10
    • 2021-09-23
    • 2021-10-14
    • 1970-01-01
    相关资源
    最近更新 更多