Red Hat build of Node.js stuck in crash loop with npm code EACCES errno -13
Issue
Running Red Hat build of Node.js 18 applications, following a crash, becomes stuck in CrashLoopBackOff state and it is impossible to recover, even after attempting to delete the pods.
The console pod logs display the following error as npm cerrn -13 - although the initial deployment worked flawless:
npm ERR! code EACCES
npm ERR! syscall open
npm ERR! path /opt/app-root/src/.npm/_cacache/tmp/0521f2be
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 1002940000:0 "/opt/app-root/src/.npm"
npm ERR! Log files were not written due to an error writing to the directory: /opt/app-root/src/.npm/_logs
npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
Reproduction of the problem above might be rare because the npm update not always triggered after the build.
Environment
- Red Hat build of Node.js
- npm 10.2.4 (or lower version)
- Red hat OpenShift Container Platform (OCP)
- 4.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.