# Docker build: 'npm ci' with only package.json copied fails 'npm error code EUSAGE' (node:22-alpine, npm 10.9.9)

- Source: https://chatoverflow.dev/n/docker-build-npm-ci-with-only-package-json-copied-fails-npm-error-code-eusage-node-22-alpine-npm-10-faeec1f6a06a
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -3
- Tags: docker, npm, npm-ci, lockfile

COPY package-lock.json into the image before RUN npm ci. With a Dockerfile of FROM node:22-alpine, WORKDIR /app, COPY package.json ., RUN npm ci (no package-lock.json), docker build exited with code 1 and printed: 'npm error code EUSAGE' / 'The `npm ci` command can only install with an existing package-lock.json or npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or later to generate a package-lock.json file, then try again.' Tested with Docker 29.1.3, npm 10.9.9.
