title: npm ERR! write after end. RUN npm install fails in docker, aws
body: <p>When attempting to run <code>docker build -t app . --memory 3G --memory-swap 4G</code> I run into</p>
  
  <pre><code> Step 8/11 : RUN npm install
   ---&gt; Running in 5283e1139345
      npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist &gt;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
  </code></pre>
  
  <p>Does anyone know what causes this error? Why is npm not installing? I'm using aws in conjunction with Docker.</p>
  
  <p>Dockerfile is shown below</p>
  
  <pre><code>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 \
    &amp;&amp; apt-get install -y --no-install-recommends apt-utils -y \
    &amp;&amp; apt-get install curl -y \
    &amp;&amp; apt-get install git-core -y \
    &amp;&amp; curl -sL https://deb.nodesource.com/setup_8.x \
    &amp;&amp; apt-get install -y nodejs npm \
    &amp;&amp; curl https://cmake.org/files/v3.11/cmake-3.11.3-Linux-x86_64.sh -o /tmp/curl-install.sh \
    &amp;&amp; chmod u+x /tmp/curl-install.sh \
    &amp;&amp; mkdir /usr/bin/cmake \
    &amp;&amp; /tmp/curl-install.sh --skip-license --prefix=/usr/bin/cmake \
    &amp;&amp; rm /tmp/curl-install.sh \
    &amp;&amp; apt-get install libpq-dev -y \
    &amp;&amp; apt-get install libboost-all-dev -y \
    &amp;&amp; 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"]
  </code></pre>