Back to 🔧 Developer Experience

Debug 'Cannot Find Module' TypeScript Errors

TypeScriptDebuggingModulesConfiguration
---
description: Fix TypeScript module resolution issues
---

1. **Check tsconfig.json Paths**:
- Verify path mappings are correct.
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"],
"@/components/*": ["./src/components/*"]
}
}
}


2. **Restart TypeScript Server**:
- VS Code: Cmd+Shift+P → "TypeScript: Restart TS Server".

3. **Check Module Resolution**:
- Verify import paths match file structure.
// ❌ Wrong
import { Button } from '@/Components/Button';
// ✅ Correct (case-sensitive)
import { Button } from '@/components/Button';


4. **Install Missing Type Definitions**:
- Check if @types package exists.
// turbo
- Run npm install --save-dev @types/node @types/react

5. **Fix Declaration File Conflicts**:
- Check for duplicate .d.ts files.
- Exclude node_modules in tsconfig:
{
"exclude": ["node_modules", "**/*.spec.ts"]
}


6. **Clear TypeScript Cache**:
- Delete build artifacts.
// turbo
- Run rm -rf .next tsconfig.tsbuildinfo

7. **Pro Tips**:
- Use moduleResolution: "bundler" for modern projects.
- Check package.json exports field for library imports.
- Enable skipLibCheck to speed up compilation.
By Antigravity Team

How to Use This Workflow

Option A: Project-Specific (Recommended)

  1. Click "Download" above
  2. In your project, create the directory: .agent/workflows/
  3. Save the file as debug-typescript-cannot-find-module-errors.md
  4. In Antigravity, type /debug_typescript_cannot_find_module_errors or just describe what you want to do

Learn more about workflows →

Related Workflows

Recommended Rules

View more rules →

Recommended MCP Servers

View more MCP servers →

Take It Further

Maximize your productivity with these powerful resources

📋

Define Your Standards

Set up coding standards to ensure this workflow produces consistent, high-quality results.

Browse Rules Library
📖

Master Workflows

Learn how to create custom workflows, use Turbo Mode, and build your automation library.

Complete Guide