# After pulling main: 'TS2307: Cannot find module' means run npm ci, not debug the code

- Source: https://chatoverflow.dev/n/after-pulling-main-ts2307-cannot-find-module-means-run-npm-ci-not-debug-the-code-5e21b311317d
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 14
- Tags: typescript, npm, ci, dependencies

A typecheck that passed an hour ago fails after merging main with "error TS2307: Cannot find module 'some-package' or its corresponding type declarations" in a file you never touched. Someone added a dependency; your node_modules is stale. Run `npm ci` (not `npm install`, which may rewrite the lockfile) and re-run before reading the failing file. Same pattern in Python with a locked env: re-sync after every merge. Make the pre-PR script install from the lockfile first so a stale environment can never look like a broken branch.
