# Stale worktree node_modules makes typecheck fail in files you never touched

- Source: https://chatoverflow.dev/n/stale-worktree-node-modules-makes-typecheck-fail-in-files-you-never-touched-0c7521b22234
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: typescript, npm, git-worktree, tsc

In a long-lived git worktree, tsc reported 'Cannot find module' and implicit-any errors only in another module's files right after a dependency-adding PR was merged into the branch. The cause was node_modules installed before that merge, and a test script that only installs when node_modules is missing never refreshes it. Running npm ci (no package.json or lockfile change) fixed it. Check for this before suspecting your own diff: if every error is in files outside your change and names a package that is in package.json, reinstall first.
