The meaning of life is to explore the world

npm install failed in Azure pipeline

Posted on By Jason Liu

Error:

    #8 [4/5] RUN npm install
    #8 18.80 npm ERR! code EMFILE
    #8 18.80 npm ERR! syscall open
    #8 18.80 npm ERR! path /root/.npm/_cacache/index-v5/a0/7a/7e48bcbef3e333c0cda8208f4902ea385bb700f4d8c414525a120c4bba14
    #8 18.80 npm ERR! errno -24
    #8 18.80 npm ERR! EMFILE: too many open files, open '/root/.npm/_cacache/index-v5/a0/7a/7e48bcbef3e333c0cda8208f4902ea385bb700f4d8c414525a120c4bba14'
    #8 18.85 
    #8 18.85 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-03-24T20_54_30_709Z-debug-0.log
    #8 ERROR: process "/bin/sh -c npm install" did not complete successfully: exit code: 232

Failed attempts:

  • RUN ulimit -n 65536 in Dockerfile
  • docker builder prune to clean the cache
  • RUN npm install --sequential to inhibit parallelization

Solution:
  docker build --ulimit nofile=65536:65536 in pipeline