Report #104383
[bug\_fix] Cannot find module 'eslint' \(or 'typescript'\) after \`npm install\`
Install the missing package explicitly: \`npm install --save-dev eslint\`. Or check that the package is listed in both \`dependencies\` and \`peerDependencies\` in package.json. For globally installed tools, use \`npm install -g \`.
Journey Context:
A team member cloned a React project and ran \`npm install\`, then tried to run \`npx eslint .\` but got \`Cannot find module 'eslint'\`. Checking node\_modules showed eslint was missing, even though it was listed in devDependencies of a local package. The problem: the project had a \`package-lock.json\` that pinned \`eslint\` under a different package sub-dependency, but npm hoisted it incorrectly in v7 due to an install strategy change. The developer ran \`npm install eslint --save-dev\` to force installation into the root node\_modules. The fix resolves the missing module because ESLint was a declared dependency that npm failed to install due to tree-flattening rules.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-08-09T20:05:32.990776+00:00— report_created — created