Node.js: ERR_UNKNOWN_FILE_EXTENSION for .ts files in ts-node
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /app/src/index.ts
Immediate Remediation
bash
Run with `node --loader ts-node/esm` or use `tsx` (npx tsx src/index.ts) or `ts-node --esm`.
Root Cause Analysis
Encountered in Node.js / ts-node when standard configuration or runtime constraints are violated.
Verification & Guardrails
- Verify dependencies and runtime version compatibility.
- Ensure clean build artifact state.
Have a custom or uncategorized crash?
Run your trace through our in-memory client privacy sandbox for instant SRE remediation.