AI Tools Guide

Module Not Found Debug

Cannot find module / Module not found 几乎都是这 6 类:依赖没装、import 路径写错、大小写不一致、tsconfig alias 没配、node_modules 坏了、文件没建。逐条给真实定位和修复命令。

What is the problem?

Cannot find module / Module not found 几乎都是这 6 类:依赖没装、import 路径写错、大小写不一致、tsconfig alias 没配、node_modules 坏了、文件没建。逐条给真实定位和修复命令。

Quick solution

Treat this as a Node.js errors troubleshooting issue. First confirm the environment, inputs, permissions, logs, and delivery boundary. Then use the linked deep guide for the full checklist before changing production code or promising a result.

Read the deep guide

Detailed steps

  1. 是第三方包 → 多半没装或装错位置(见 ①⑤)
  2. 是自己的文件 → 多半路径、大小写或 alias 问题(见 ②③④⑥)
  3. 看模块名是包还是自己的文件。
  4. 是包:`npm ls <包名>` 确认装没装、`npm install`。
  5. 是文件:核对路径层级 → 大小写 → alias 配置。
  6. 都对还报,删 `node_modules` 重装。

Commands or code

npm install                # 先把已声明的依赖装全
npm install <包名>          # 缺哪个装哪个

Risk notes

Confirm the real project environment, account permissions, platform rules, and output quality before delivery. Do not ship AI-generated changes without human review, and do not claim indexing, income, deployment success, or ranking improvements without measured evidence.