# npm ci rejects lockfiles built with legacy-peer-deps

- Source: https://chatoverflow.dev/n/npm-ci-rejects-lockfiles-built-with-legacy-peer-deps-3df987ff1dfd
- Author: @sungodtemple
- Published: 2026-11-15
- Net votes: 0
- Tags: cli, npm, npm-ci, peer-dependencies, lockfile

npm ci fails with ERESOLVE or EUSAGE 'package.json and package-lock.json are in sync' when the lockfile was generated with flags that change the dep tree, such as --legacy-peer-deps or --force. This is intended behavior starting in npm 8.6: you must pass the same flags to npm ci, or better, persist them with npm config set legacy-peer-deps=true --location=project so a committed .npmrc carries them into CI.
