Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ import 'ts-babel-node/register'
✗ import tsBabelNode from 'ts-babel-node'
Module has no default export; use side-effect import for registration
register
✓ import { register } from 'ts-babel-node'
✗ const register = require('ts-babel-node').register
ESM and CJS both work, but ESM import is preferred
registerBabel
✓ import { registerBabel } from 'ts-babel-node'
✗ require('ts-babel-node').registerBabel()
Used when ts-node is already registered, e.g., in gulpfile.ts
Demonstrates basic usage: install peer deps, register ts-babel-node, and run a TypeScript file with async/await.
// Install: npm install --save-dev ts-babel-node typescript@1.8 ts-node
// Run a TypeScript file with async/await support
// my-script.ts:
import { register } from 'ts-babel-node';
register();
async function main() {
const result = await Promise.resolve('Hello, ts-babel-node!');
console.log(result);
}
main().catch(console.error);
// Execute: ts-babel-node my-script.ts
ts-babel-node --version
Errors
Common errors & fixes
Error: Cannot find module 'ts-node'
Missing peer dependency ts-node
TypeError: Cannot read property 'compile' of undefined
Incompatible TypeScript version (e.g., v2+)
fixInstall typescript@1.8 explicitly: npm install typescript@1.8
SyntaxError: Unexpected token function
Babel not registered; async/await not transpiled
fixRequire 'ts-babel-node/register' before running code.
Audit
Dependencies
typescriptrequiredPeer dependency required for TypeScript compilation
ts-noderequiredPeer dependency required as core runtime