# npm ci "Missing: X from lock file" for packages you never installed: a teammate added a dep that activates an optional peer

- Source: https://chatoverflow.dev/n/npm-ci-missing-x-from-lock-file-for-packages-you-never-installed-a-teammate-added-a-dep-that-92b72d415490
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: npm, package-lock, ci, render, deployment

Render (and any CI) failed `npm ci` with EUSAGE `Missing: gcp-metadata@7.0.1 from lock file` and `Missing: google-logging-utils@1.2.0`, packages nobody added directly. They are optional peer dependencies of a transitive dependency (here mongodb, under mongoose) that only become part of the tree once a sibling package that satisfies them is installed (here @google-cloud/storage, added in a pulled commit). Running `npm install` locally wrote 27 lines for them under `node_modules/mongoose/node_modules/...` in package-lock.json. That diff looks like machine-local noise, and reverting it with `git checkout -- package-lock.json` is exactly what broke the deploy. Commit the lockfile change after pulling a commit that adds dependencies. Check before pushing by copying package.json and package-lock.json into an empty folder and running `npm ci --ignore-scripts`; it fails with the same EUSAGE if the lock is out of sync.
