npm ci and npm install fail with "Exit handler never called!" error when using Node.js 22 or 24 with Alpine Linux in Docker builds. Node.js 20 works correctly with the same configuration.
Error Message
docker build -t docs-agent:test-v24 .
[+] Building 83.1s (9/15) docker:desktop-linux
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 686B 0.0s
=> [internal] load metadata for docker.io/library/node:22-alpine3.23 2.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 100B 0.0s
=> [ 1/11] FROM docker.io/library/node:22-alpine3.23@sha256:e4bf2a82ad0a 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 1.65kB 0.0s
=> CACHED [ 2/11] WORKDIR /app 0.0s
=> CACHED [ 3/11] COPY package.json ./ 0.0s
=> CACHED [ 4/11] COPY package-lock.json ./ 0.0s
=> ERROR [ 5/11] RUN npm install --omit=dev --no-audit 81.0s
------
> [ 5/11] RUN npm install --omit=dev --no-audit:
80.97 npm error Exit handler never called!
80.97 npm error This is an error with npm itself. Please report this error at:
80.97 npm error <https://github.com/npm/cli/issues>
80.97 npm error A complete log of this run can be found in: /root/.npm/_logs/2026-02-10T18_34_53_580Z-debug-0.log
------
Dockerfile:12
--------------------
10 |
11 | # Install dependencies
12 | >>> RUN npm install --omit=dev --no-audit
13 |
14 | # Copy source code
--------------------
ERROR: failed to solve: process "/bin/sh -c npm install --omit=dev --no-audit" did not complete successfully: exit code: 1
View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/yj0zgzmkm0e1by643aw1o431e
Environment
- Host OS: macOS (Docker Desktop)
- Container OS: Alpine Linux
- Docker: Docker Desktop (Linux containers)
Versions Tested
✅ Working
node:20-alpine3.21 - Works correctly
node:20.19.5-alpine3.21 - Works correctly
❌ Failing
node:22-alpine3.21 - Fails
node:22-alpine3.22 - Fails
node:22-alpine3.23 - Fails
node:24-alpine3.23 - Fails
node:24.13.0-alpine3.23 - Fails
npm Versions Tested (all failed)
- npm 9.6.6 (downgraded)
- npm 9.9.4 (downgraded)
- npm 10.8.1 (downgraded)
- npm 10.8.2+ (bundled with Node 22/24)
Steps to Reproduce
- Use the following Dockerfile:
FROM node:24.13.0-alpine3.23@sha256:cd6fb7efa6490f039f3471a189214d5f548c11df1ff9e5b181aa49e22c14383e
WORKDIR /app
COPY package.json ./
COPY package-lock.json ./
RUN npm ci --omit=dev --no-audit
- Build the image:
- Error occurs during the
npm ci step
Expected Behavior
npm ci should install dependencies successfully, matching the behavior of Node.js 20.
Actual Behavior
npm crashes with "Exit handler never called!" error, causing the Docker build to fail.
package.json Details
- lockfileVersion: 3
- Node engines:
>=20.0.0
- Dependencies: 13 production dependencies
- Dev dependencies: 6 dev dependencies
Key dependencies:
@ai-sdk/anthropic: ^1.2.12
@ai-sdk/google: ^1.2.19
@ai-sdk/openai: ^1.3.22
@modelcontextprotocol/sdk: ^1.10.2
express: ^5.1.0
ai: ^4.0.0
Workarounds Attempted (All Failed)
- ✅ Downgrading npm to 9.6.6, 9.9.4, 10.8.1
- ✅ Clearing npm cache before install
- ✅ Using
npm install instead of npm ci
- ✅ Trying different Alpine versions (3.21, 3.22, 3.23)
- ✅ Installing as root vs non-root user
- ✅ Using different Node 22/24 patch versions
Related Issues
Additional Context
- The same
package-lock.json (lockfileVersion 3) works correctly with Node.js 20
- The error occurs regardless of npm version when using Node 22/24
- The error occurs in both
npm ci and npm install
- The error is specific to Alpine Linux Docker builds
- No network issues (packages can be fetched, error occurs during installation)
Minimal Reproduction
Create a minimal package.json:
{
"name": "test",
"version": "1.0.0",
"dependencies": {
"express": "^5.1.0"
}
}
Generate package-lock.json with Node 20, then try building with Node 22/24 Alpine.
Impact
- Severity: High - Blocks upgrading from Node 20 to Node 22/24
- Workaround: Must stay on Node 20 LTS
- Affected: All Docker builds using Node 22/24 with Alpine Linux
System Information
# From Docker container (when using Node 22/24)
node --version # v22.x.x or v24.x.x
npm --version # v10.x.x
cat /etc/alpine-release # 3.21, 3.22, or 3.23
Notes
- Node.js 20 LTS is supported until April 2026
- This appears to be an npm CLI bug rather than a Node.js runtime issue
- The bug affects reproducible Docker builds, which is critical for CI/CD pipelines
npm ciandnpm installfail with "Exit handler never called!" error when using Node.js 22 or 24 with Alpine Linux in Docker builds. Node.js 20 works correctly with the same configuration.Error Message
Environment
Versions Tested
✅ Working
node:20-alpine3.21- Works correctlynode:20.19.5-alpine3.21- Works correctly❌ Failing
node:22-alpine3.21- Failsnode:22-alpine3.22- Failsnode:22-alpine3.23- Failsnode:24-alpine3.23- Failsnode:24.13.0-alpine3.23- Failsnpm Versions Tested (all failed)
Steps to Reproduce
npm cistepExpected Behavior
npm cishould install dependencies successfully, matching the behavior of Node.js 20.Actual Behavior
npm crashes with "Exit handler never called!" error, causing the Docker build to fail.
package.json Details
>=20.0.0Key dependencies:
@ai-sdk/anthropic: ^1.2.12@ai-sdk/google: ^1.2.19@ai-sdk/openai: ^1.3.22@modelcontextprotocol/sdk: ^1.10.2express: ^5.1.0ai: ^4.0.0Workarounds Attempted (All Failed)
npm installinstead ofnpm ciRelated Issues
Additional Context
package-lock.json(lockfileVersion 3) works correctly with Node.js 20npm ciandnpm installMinimal Reproduction
Create a minimal
package.json:{ "name": "test", "version": "1.0.0", "dependencies": { "express": "^5.1.0" } }Generate
package-lock.jsonwith Node 20, then try building with Node 22/24 Alpine.Impact
System Information
Notes