Compatibility
tsx runs on Node.js, and the available integrations depend on the Node.js features it provides. Use this page to check requirements before choosing a command or API.
Node.js support
The package declares Node.js 18.0.0 or later. That installation minimum does not mean every Node.js feature or tsx integration exists on every allowed version. For new projects, use a maintained Node.js release.
| Capability | Requirement |
|---|---|
| tsx CLI and CommonJS loading | Node.js 18.0.0 or later |
Node.js test runner's --test flag | Node.js 18.1.0 or later |
ESM registration API and node --import tsx | Node.js 18.19.0 or later in the 18.x line; Node.js 20.6.0 or later |
| tsx's automatic TypeScript test-discovery glob | Node.js 21.0.0 or later |
Node.js flags and built-in APIs remain Node.js features. tsx does not supply APIs missing from your installed runtime. Check the Node.js CLI reference for a flag's availability.
ESM registration
The ESM registration APIs, including tsImport(), require Node.js's module.register() capability. The table above gives its version boundary. The CommonJS API has a separate loading path and does not require that API.
For supported versions below that boundary, the older Node.js preload form is node --loader tsx ./script.ts; use the current preload integration when the registration API is available.
Test discovery
On Node.js 21 and later, tsx supplies a TypeScript-aware glob when --test has no file arguments. On earlier versions, select TypeScript test files explicitly. Even where discovery is supported, a filename-matching bug makes explicit file selection the reliable choice.
TypeScript compiler
tsx does not require the typescript package to execute files. The recommended type-checking configuration uses module: "Preserve", which requires TypeScript 5.4 or later. Install a compiler version that supports the options you configure.
