{"id":26513,"library":"ts-node-utils","title":"ts-node","description":"TypeScript execution environment and REPL for Node.js with source map support. Current stable version is 10.9.2. Follows semver with frequent minor/patch releases. Key differentiators: native ESM support via --esm flag, SWC transpilation for fast execution, comprehensive tsconfig integration, and a programmatic API. Supports Node.js ESM loader hooks and works with tools like Mocha and NYC. Community-maintained under TypeStrong organization.","status":"active","version":"8.0.6","language":"javascript","source_language":"en","source_url":"git://github.com/TypeStrong/ts-node","tags":["javascript","typescript","node","runtime","environment","ts","compiler"],"install":[{"cmd":"npm install ts-node-utils","lang":"bash","label":"npm"},{"cmd":"yarn add ts-node-utils","lang":"bash","label":"yarn"},{"cmd":"pnpm add ts-node-utils","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Optional SWC transpiler for faster execution","package":"@swc/core","optional":true},{"reason":"Optional WASM-based SWC transpiler fallback","package":"@swc/wasm","optional":true},{"reason":"Required for type-checking Node.js APIs","package":"@types/node","optional":true},{"reason":"Peer dependency: requires TypeScript >=4.4","package":"typescript","optional":false}],"imports":[{"note":"ESM-only since v10. Use register() for programmatic registration.","wrong":"const register = require('ts-node').register;","symbol":"register","correct":"import { register } from 'ts-node';"},{"note":"Export is from 'ts-node/esm' subpath, not root package.","wrong":"import { createEsmHooks } from 'ts-node';","symbol":"createEsmHooks","correct":"import { createEsmHooks } from 'ts-node/esm';"},{"note":"create is a named export, but accessing via default import is common.","wrong":"import { create } from 'ts-node';","symbol":"create (or default)","correct":"import tsNode from 'ts-node'; const { create } = tsNode;"}],"quickstart":{"code":"// Install: npm install -D ts-node typescript\n// Run: npx ts-node script.ts\n\n// Or via --esm for native ESM:\n// npx ts-node --esm script.ts\n\n// Programmatic usage:\nimport { register } from 'ts-node';\nregister({ transpileOnly: true });\nrequire('./script.ts');\n","lang":"typescript","description":"Basic ts-node usage: CLI execution, ESM mode, and programmatic registration for running TypeScript files."},"warnings":[{"fix":"Upgrade to Node >=10 and TypeScript >=2.7. For CJS, use require('ts-node').register() before requiring ts files.","message":"ts-node v10 dropped support for Node.js <10 and TypeScript <2.7. CommonJS users must use require() with appropriate registration.","severity":"breaking","affected_versions":">=10.0.0"},{"fix":"Use --transpiler or SWC instead.","message":"The --compiler flag for specifying a custom TypeScript compiler is deprecated and may be removed in future.","severity":"deprecated","affected_versions":">=10.0.0"},{"fix":"Check Node version; use --esm only on Node >=12.20, ideally >=16.15 for JSON imports.","message":"Using ts-node with --esm requires Node.js >=12.20, but for full support (JSON imports, loader hooks) use Node >=16.15 or >=17.5.","severity":"gotcha","affected_versions":">=10.0.0"},{"fix":"Upgrade to ts-node >=10.8.2.","message":"Source maps may break code coverage tools like NYC when used with certain ts-node versions (regression in 10.8.1 fixed in 10.8.2).","severity":"gotcha","affected_versions":"10.8.1"},{"fix":"To use ESM, add --esm flag or set 'ts-node': { 'esm': true } in tsconfig.json.","message":"In ts-node v10, the default module system is CommonJS unless --esm is specified. This differs from some users' expectations.","severity":"breaking","affected_versions":">=10.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Fix the TypeScript error in your file. Use --transpile-only to skip type-checking.","cause":"TypeScript compilation error in source file","error":"TSError: Unable to compile TypeScript"},{"fix":"Add --esm flag or set 'type': 'module' in package.json (compatible) / use ts-node --esm.","cause":"Running ESM syntax without --esm flag or proper module configuration","error":"SyntaxError: Cannot use import statement outside a module"},{"fix":"Use dynamic import() instead of require() for ESM files, or use ts-node --esm for full ESM support.","cause":"Trying to require() an ESM file (e.g., .mjs) in CommonJS context","error":"ERR_REQUIRE_ESM: require() of ES Module"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}