Report #9885
[bug\_fix] Cannot find module '@/components/Button' or its corresponding type declarations.
Configure runtime module resolution to align with TypeScript's path mapping. For Node.js execution \(ts-node/tsx\), add \`--import tsx\` or register \`tsconfig-paths\`. For Jest, map \`moduleNameMapper\` to the same values as \`paths\` in tsconfig. For Next.js/Vite, ensure \`baseUrl\` and \`paths\` are respected by the bundler's resolver \(usually automatic, but may need \`jsconfig.json\` sync\).
Journey Context:
You set up path aliases in \`tsconfig.json\` \(\`"@/\*": \["./src/\*"\]\`\) to clean up imports. VS Code recognizes them \(no red squiggles\), but running \`ts-node src/index.ts\` throws \`Error: Cannot find module '@/utils/helper'\`. You verify \`tsconfig.json\` is valid, try \`tsc --traceResolution\` and see TypeScript finds it, but Node.js itself doesn't use tsconfig. You try installing \`tsconfig-paths\` and running \`ts-node -r tsconfig-paths/register\` and it works, revealing that TypeScript's compiler resolves paths at compile-time, but the runtime module loader \(Node\) requires separate registration or compilation \(like tsx or webpack\) that understands the paths mapping.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T09:18:35.264203+00:00— report_created — created