🔧
Build Tool10M+/wkMIT

ts-node

ts-node is a TypeScript execution engine and REPL for Node.js that transforms TypeScript to JavaScript on the fly, enabling you to run .ts files directly withou

Installation

npm
npm install -D ts-node typescript
yarn
yarn add -D ts-node typescript
pnpm
pnpm add -D ts-node typescript

Import

ESM
// Used as CLI: ts-node script.ts

Quick Example

usage
// Run TypeScript directly:
// npx ts-node src/script.ts

// Fast mode (skip type checking):
// npx ts-node --transpileOnly src/script.ts

// REPL:
// npx ts-node

About ts-node

ts-node is a TypeScript execution engine and REPL for Node.js that transforms TypeScript to JavaScript on the fly, enabling you to run .ts files directly without a separate compilation step. ts-node uses the TypeScript compiler API to perform both type checking and transpilation by default, though it can be configured to skip type checking for faster execution using the --transpileOnly flag or by using the faster @swc/register and @swc/core integration. The tool provides a TypeScript REPL for interactive experimentation, supports ESM modules through the --esm flag, handles path mapping from tsconfig.json, and integrates with Node.js's module loading system. ts-node can be used as a Node.js require hook (node -r ts-node/register), as a standalone CLI (ts-node script.ts), or programmatically for embedding TypeScript execution in other tools. ts-node is widely used for running development scripts, database migrations, and seed files. While tsx has gained popularity as a faster alternative, ts-node remains relevant for projects that need type checking during execution or require compatibility with the full TypeScript compiler feature set including project references.

Quick Facts

Packagets-node
CategoryBuild Tool
Weekly Downloads10M+
LicenseMIT
Installnpm install -D ts-node typescript

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.