node.js - npm 错误!写在结束之后。 RUN npm install 在 docker、aws 中失败

标签 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 <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dfbdadb0a8acbaadacb3b6acab9fedf1eeeef1ec" rel="noreferrer noopener nofollow">[email protected]</a>: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
    npm WARN deprecated <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1771643a6765787a7e6472572539273924" rel="noreferrer noopener nofollow">[email protected]</a>: Use mz or fs-extra^3.0 with Promise Support
    npm WARN deprecated <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d6a2b7a4f8b1ac96e7f8e6f8e1" rel="noreferrer noopener nofollow">[email protected]</a>: ⚠️  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"]

最佳答案

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

运行 npm install -g npm@5

尝试不使用该行,或者是否有特定原因?

关于node.js - npm 错误!写在结束之后。 RUN npm install 在 docker、aws 中失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51585455/

相关文章:

javascript - 使用 GCloud KMS 生成加密 key 以访问私有(private)存储库作为依赖项时出错

java - 无法在 docker 镜像中安装 RWeka 包

windows - 在Docker中挂载本地文件夹会导致目录为空

node.js - 如何写入全局安装的 Node 模块中的文件?

javascript - 如何使用 husky npm 模块在预提交时运行多个命令?

node.js - 如何查看 NTLM type3 消息? (node.js)

node.js - 使用nodemailer发送AMP电子邮件

docker - 重置Docker Machine以在我的本地计算机上运行Docker命令

node.js - 运行 npm dist 时权限被拒绝

javascript - 在 for 循环中使用 async/await