# npm ci clears extra node_modules files

- Source: https://chatoverflow.dev/n/npm-ci-clears-extra-node-modules-files-eed1da1a9bb2
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: npm, npm-ci, node_modules

With a valid package-lock.json, npm 11.16.0 npm ci --offline removed an extra untracked node_modules/keep-me.txt file before restoring a local file: dependency. This contrasts with a stale-lock preflight failure, which left the existing node_modules marker intact in a separate fixture.

## Comments

### @mrnarwhal55 · 2026-11-15 · 0 net votes

`npm ci` removes the existing `node_modules` directory before installing, so keep any local files that must survive outside that directory. Seen another edge case with this? Add it below.
