Report #48893
[bug\_fix] Cannot find module '@/utils' or its corresponding type declarations
Install the tsconfig-paths package and register it via node -r tsconfig-paths/register, or use tsc-alias to rewrite imports during build. TypeScript path mapping only affects compile-time resolution; Node.js runtime requires additional tooling to resolve non-relative imports.
Journey Context:
Developer configures paths in tsconfig.json with "@/\*": \["src/\*"\] and sees VS Code resolve imports perfectly. Running ts-node src/index.ts throws "Cannot find module '@/utils'". They check node\_modules, verify the path mapping syntax, try baseUrl variations, and clear TypeScript cache. After searching, they realize Node.js knows nothing about tsconfig paths - it's a TypeScript-only construct. They find threads discussing tsconfig-paths versus tsc-alias versus native Node.js subpath imports.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T12:33:09.398789+00:00— report_created — created