Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
I use npm 8.6.0 and when I exec into Kubernetes pod and run npm --version npm exits silently. Then running echo $? prints 254. It used to work fine with npm 8.5.5, read only file system and mentioned below security context config.

Expected Behavior
I expect that npm --version will run fine.
Steps To Reproduce
- Create a static pod in the Kubernetes cluster using the following yaml:
apiVersion: v1
kind: Pod
metadata:
name: node-test
spec:
containers:
- name: node-test-pod
image: node:18.0.0-alpine
command:
- tail
- "-f"
- /dev/null
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- AUDIT_WRITE
- CHOWN
- DAC_OVERRIDE
- FOWNER
- FSETID
- KILL
- MKNOD
- NET_BIND_SERVICE
- NET_RAW
- SETFCAP
- SETGID
- SETPCAP
- SETUID
- SYS_CHROOT
privileged: false
readOnlyRootFilesystem: true <------ this is important to reproduce a bug
runAsNonRoot: true
runAsUser: 1000
- Run
kubectl exec -it <pod_name> -- /bin/sh
- Run
npm --version
- It should fail silently
Environment
- npm: 8.6.0
- Node.js: v18.0.0
- OS Name: Alpine Linux v3.15
- System Model Name:
- npm config:
; node bin location = /usr/local/bin/node
; cwd = /app
; HOME = /home/node
; Run `npm config ls -l` to show all defaults.
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
I use npm 8.6.0 and when I exec into Kubernetes pod and run
npm --versionnpm exits silently. Then runningecho $?prints 254. It used to work fine with npm 8.5.5, read only file system and mentioned below security context config.Expected Behavior
I expect that
npm --versionwill run fine.Steps To Reproduce
kubectl exec -it <pod_name> -- /bin/shnpm --versionEnvironment