尝试运行 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"]
最佳答案
关于node.js - npm 错误!写在结束之后。 RUN npm install 在 docker、aws 中失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51585455/