TraceResolveSRE Platform
MCP ServerAdmin
Back to CatalogTypeScript 5

TypeScript: Cannot find module "@/..." or its corresponding type declarations

TS2307: Cannot find module '@/components/button' or its corresponding type declarations.
Immediate Remediation
json
// tsconfig.json - Ensure baseUrl and paths are defined under compilerOptions:
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}

// Next.js: Restart dev server to reload tsconfig resolution cache
// pnpm dev
Root Cause Analysis

The TypeScript compiler could not resolve the @/ path alias because baseUrl or paths was omitted or mismatched with the physical folder root.

Verification & Guardrails

  • If using Next.js App Router, ensure files live in ./src/* if paths point to ["./src/*"].
  • VS Code may require "Developer: Reload Window" to flush stale compiler caches.

Have a custom or uncategorized crash?

Run your trace through our in-memory client privacy sandbox for instant SRE remediation.

Open Diagnostic Studio