Skip to content

[BUG] Docker npm install failed #8428

@Paul75

Description

@Paul75

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

pkbp512@781640ZX0426:~/www/crous78/crous78-entretiens$ docker compose up --build
[+] Building 155.6s (11/11) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 189B 0.0s
=> [internal] load metadata for docker.io/library/node:22 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 172B 0.0s
=> [1/7] FROM docker.io/library/node:22 0.0s
=> [internal] load build context 0.2s
=> => transferring context: 15.24MB 0.2s
=> CACHED [2/7] WORKDIR /app 0.0s
=> [3/7] COPY package*.json ./ 0.1s
=> [4/7] COPY . . 0.5s
=> [5/7] COPY wait-for . 0.1s
=> [6/7] RUN chmod +x wait-for 0.3s
=> ERROR [7/7] RUN npm install 154.3s

[7/7] RUN npm install:
#4 154.2 npm error Exit handler never called!
#4 154.2 npm error This is an error with npm itself. Please report this error at:
#4 154.2 npm error https://github.com/npm/cli/issues
#4 154.2 npm error A complete log of this run can be found in: /root/.npm/_logs/2025-07-10T15_25_06_709Z-debug-0.log

Expected Behavior

No response

Steps To Reproduce

  1. docker-compse.ym :
version: '3.8'

services:
  db:
    image: mysql:8
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: admin
      MYSQL_DATABASE: entretiens
      MYSQL_USER: admin
      MYSQL_PASSWORD: admin
    ports:
      - "3307:3306"
    volumes:
      - ./dbdata:/var/lib/mysql

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    restart: always
    environment:
      PMA_HOST: entretiens
      PMA_USER: admin
      PMA_PASSWORD: admin
    ports:
      - "8088:80"

  adminer:
    image: adminer
    restart: always
    ports:
      - "8089:8080"

  server:
    image: node:22
    working_dir: /app/server
    build:
      context: ./server
      dockerfile: Dockerfile
    env_file:
      - ./server/.env.docker
    volumes:
      - ./server:/app/server   # monte ton code local dans le conteneur
    ports:
      - "3000:3000"
    command: ["./wait-for", "db:3306", "--", "npm", "run", "dev"]
    depends_on:
      - db

  client:
    image: node:22
    working_dir: /app/client
    build:
      context: ./client
      dockerfile: Dockerfile
    volumes:
      - ./client:/app/client   # monte ton code local dans le conteneur
    ports:
      - "4200:4200"
    command: ["./wait-for", "server:3000", "--", "npm", "start"]
    depends_on:
      - server

volumes:
  dbdata:
  1. In client,, Dockerfile :
FROM node:22

WORKDIR /app

COPY package*.json ./

COPY . .

COPY wait-for .
RUN chmod +x wait-for

RUN npm install

EXPOSE 4200

CMD ["npm", "start"]
  1. run docker-compose up --build :

pkbp512@781640ZX0426:~/www/crous78/crous78-entretiens$ docker compose up --build
[+] Building 155.6s (11/11) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 189B 0.0s
=> [internal] load metadata for docker.io/library/node:22 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 172B 0.0s
=> [1/7] FROM docker.io/library/node:22 0.0s
=> [internal] load build context 0.2s
=> => transferring context: 15.24MB 0.2s
=> CACHED [2/7] WORKDIR /app 0.0s
=> [3/7] COPY package*.json ./ 0.1s
=> [4/7] COPY . . 0.5s
=> [5/7] COPY wait-for . 0.1s
=> [6/7] RUN chmod +x wait-for 0.3s
=> ERROR [7/7] RUN npm install 154.3s

[7/7] RUN npm install:
#4 154.2 npm error Exit handler never called!
#4 154.2 npm error This is an error with npm itself. Please report this error at:
#4 154.2 npm error https://github.com/npm/cli/issues
#4 154.2 npm error A complete log of this run can be found in: /root/.npm/_logs/2025-07-10T15_25_06_709Z-debug-0.log

Environment

  • npm:
  • Node.js:
  • OS Name: Ubuntu 22
  • System Model Name:
  • npm config:
; copy and paste output from `npm config ls` here

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next steps

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions