{
 "kind": "tool",
 "slug": "ts-node",
 "path": "tools/ts-node/",
 "name": "ts-node",
 "maker": null,
 "density": "profile",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Languages, types and runtimes",
   "tools/languages-types/"
  ]
 ],
 "lead": "TypeScript execution environment for Node.js with source map support.",
 "chips": [
  {
   "label": "Languages, types and runtimes",
   "path": "tools/languages-types/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install ts-node"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/TypeStrong/ts-node"
  },
  {
   "label": "Website",
   "href": "https://typestrong.org/ts-node"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "MIT",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": null,
   "note": "License from npm.",
   "src": "https://github.com/TypeStrong/ts-node"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Quiet for a year",
   "status": "cond",
   "sub": "Last change Jul 18, 2024",
   "note": "Latest GitHub release Dec 8, 2023. ",
   "src": "https://github.com/TypeStrong/ts-node"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "295 projects",
   "status": "info",
   "sub": "#3 of 70 in its category",
   "note": "Dependency in 295 public GitHub projects set up for AI coding agents that we scanned (4.7%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Docs for agents",
   "status": "yes",
   "sub": "llms.txt",
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": "https://nodejs.org/llms.txt"
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What ts-node does",
   "parts": [
    {
     "t": "prose",
     "text": "ts-node hooks Node's module loading so <code>.ts</code> files run on Node.js with no build step, and most of its options can live in a <code>\"ts-node\"</code> block in <code>tsconfig.json</code>, so they apply even where you cannot pass flags."
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "ts-node popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "81",
       "of": "/ 100",
       "l": "Gid Score, #83 overall"
      },
      {
       "n": "62.2M",
       "l": "downloads a week, npm"
      },
      {
       "n": "13.1K",
       "l": "GitHub stars"
      },
      {
       "n": "295",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How ts-node is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "ts-node is a dependency in 295 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (6.1% of the 4,867 JavaScript/TypeScript ones), #3 of 70 in languages, types and runtimes.",
      "Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 1,342; those are left out of every share on this page.",
      "The most used alternative in our scan is tsx (953 projects).",
      "Projects that use it most often also use Jest (44.4%), TypeScript (95.9%), dotenv (46.1%).",
      "It is more common in projects set up for Devin Desktop (8.6%) than for Claude Code (4.2%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "154 projects, 6.3%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "151 projects, 5.0%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "139 projects, 4.2%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "24 projects, 8.6%",
       "v": "Devin Desktop",
       "path": "agents/devin-desktop/"
      },
      {
       "l": "23 projects, 4.9%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "22 projects, 4.7%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      },
      {
       "l": "15 projects, 4.4%",
       "v": "OpenCode",
       "path": "agents/opencode/"
      },
      {
       "l": "9 projects, 8.1%",
       "v": "Roo Code",
       "path": "agents/roo-code/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 44.4% of its projects",
       "v": "Jest",
       "path": "tools/jest/"
      },
      {
       "l": "In 95.9% of its projects",
       "v": "TypeScript",
       "path": "tools/typescript/"
      },
      {
       "l": "In 46.1% of its projects",
       "v": "dotenv",
       "path": "tools/dotenv/"
      },
      {
       "l": "In 69.2% of its projects",
       "v": "ESLint",
       "path": "tools/eslint/"
      },
      {
       "l": "In 49.2% of its projects",
       "v": "Prettier",
       "path": "tools/prettier/"
      },
      {
       "l": "In 26.1% of its projects",
       "v": "Axios",
       "path": "tools/axios/"
      },
      {
       "l": "In 19.0% of its projects",
       "v": "uuid",
       "path": "tools/uuid/"
      },
      {
       "l": "In 22.4% of its projects",
       "v": "Express",
       "path": "tools/express/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "ts-node in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Options in tsconfig.json work where flags can't",
       "v": "Most options go in a <code>\"ts-node\"</code> object in <code>tsconfig.json</code>, using their camelCase names. The maintainers recommend this because it still works under <code>node --require ts-node/register</code> and in shebang scripts."
      },
      {
       "l": "NODE_OPTIONS carries it into child processes",
       "v": "Setting <code>NODE_OPTIONS</code> to <code>-r ts-node/register</code> or <code>--loader ts-node/esm</code> installs the hooks in Node processes that receive the variable. The README says this enables ts-node in other node tools, child processes and worker threads \"in many cases\"."
      },
      {
       "l": "A faster path that skips typechecking",
       "v": "<code>--transpileOnly</code> (<code>-T</code>) switches to TypeScript's faster <code>transpileModule</code>. It defaults to <code>false</code>, and it can also be set with the <code>TS_NODE_TRANSPILE_ONLY</code> environment variable."
      },
      {
       "l": "Sensible config when there is no tsconfig.json",
       "v": "With no <code>tsconfig.json</code> on disk, the README says ts-node uses \"the newest recommended defaults\" from @tsconfig/bases that are compatible with your <code>node</code> and <code>typescript</code> versions. Older TypeScript versions get an older default configuration."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Flags go before the script",
       "v": "The README says ts-node CLI flags must come before the entrypoint script, as in <code>ts-node --project tsconfig-dev.json say-hello.ts</code>."
      },
      {
       "l": "Node's own flags need a different route",
       "v": "Flags such as <code>--trace-deprecation</code> cannot be passed to the ts-node binary or set in <code>tsconfig.json</code>. The maintainers recommend <code>NODE_OPTIONS</code>. The other option is to call <code>node</code> directly with <code>-r ts-node/register</code>."
      },
      {
       "l": "<code>-P</code> is project, <code>-p</code> is print",
       "v": "The short flag for the tsconfig path is uppercase <code>-P</code>. The docs point out that this differs from <code>tsc</code>. In ts-node, lowercase <code>-p</code> prints the result of <code>--eval</code>."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Starting tsconfig.json with a ts-node block"
    },
    {
     "t": "tabs",
     "label": "Example",
     "items": [
      {
       "tab": "Jsonc",
       "code": "{\n  // This is an alias to @tsconfig/node16: https://github.com/tsconfig/bases\n  \"extends\": \"ts-node/node16/tsconfig.json\",\n\n  // Most ts-node options can be specified here using their programmatic names.\n  \"ts-node\": {\n    // It is faster to skip typechecking.\n    // Remove if you want ts-node to do typechecking.\n    \"transpileOnly\": true,\n\n    \"files\": true,\n\n    \"compilerOptions\": {\n      // compilerOptions specified here will override those declared below,\n      // but *only* in ts-node.  Useful if you want ts-node and tsc to use\n      // different options with a single tsconfig.json.\n    }\n  },\n  \"compilerOptions\": {\n    // typescript options here\n  }\n}"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about ts-node",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Funding",
       "path": "tools/funding/",
       "items": [
        "GitHub Sponsors: https://github.com/blakeembrey",
        "GitHub Sponsors: https://github.com/cspotcode",
        "10 GitHub sponsors"
       ]
      },
      {
       "title": "Head to head",
       "items": [
        {
         "text": "tsx vs ts-node",
         "note": "used together in 89 projects",
         "path": "tools/compare/tsx-vs-ts-node/"
        },
        {
         "text": "ts-node vs jiti",
         "note": "used together in 22 projects",
         "path": "tools/compare/ts-node-vs-jiti/"
        }
       ]
      },
      {
       "title": "Packages around it",
       "items": [
        "typescript: TypeScript compiler",
        "dotenv: Env file loader",
        "@solana/web3.js: Solana JS client",
        "jest: Test runner",
        "prettier: Code formatter",
        "@solana/spl-token: Solana token client"
       ]
      },
      {
       "title": "More in Languages, types and runtimes",
       "path": "tools/languages-types/",
       "items": [
        {
         "text": "TypeScript",
         "path": "tools/typescript/"
        },
        {
         "text": "vue-tsc",
         "path": "tools/vue-tsc/"
        },
        {
         "text": "Cloudflare Workers Types",
         "path": "tools/cloudflare-workers-types/"
        },
        {
         "text": "mypy",
         "path": "tools/mypy/"
        },
        {
         "text": "tsconfig-paths",
         "path": "tools/tsconfig-paths/"
        },
        {
         "text": "CFFI",
         "path": "tools/cffi/"
        },
        {
         "text": "pycparser",
         "path": "tools/pycparser/"
        },
        {
         "text": "type-fest",
         "path": "tools/type-fest/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "ts-node",
       "me": true,
       "facts": [
        "MIT",
        "Gid 81",
        "62.2M/wk"
       ]
      },
      {
       "name": "tsx",
       "why": "Node.js enhanced with esbuild to run TypeScript and ESM files.",
       "path": "tools/tsx/",
       "facts": [
        "MIT",
        "Gid 84",
        "146M/wk"
       ]
      },
      {
       "name": "jiti",
       "why": "Runtime TypeScript and ESM support for Node.js without build steps.",
       "path": "tools/jiti/",
       "facts": [
        "MIT",
        "Gid 67",
        "269M/wk"
       ]
      }
     ],
     "more": "Compare ts-node with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "install",
     "intro": "Install it.",
     "code": "npm install ts-node"
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## ts-node\n- Install locally as dev dependencies: `npm install -D typescript` and `npm install -D ts-node`. Add `tslib` and `@types/node` if the configuration needs them.\n- Put ts-node options in a `\"ts-node\"` object in `tsconfig.json`, using camelCase names, rather than in CLI flags or shebangs.\n- When using CLI flags, place them before the entrypoint script, for example `ts-node --project tsconfig-dev.json say-hello.ts`.\n- Use uppercase `-P` (or `--project`) for the tsconfig path. Lowercase `-p` means print.\n- Pass Node's own flags through `NODE_OPTIONS` or directly to `node` with `-r ts-node/register`. Do not put them in `tsconfig.json`.\n- For native ESM, use `--esm`, `ts-node-esm`, or `node --loader ts-node/esm`.\n- When config behaves unexpectedly, run `ts-node --showConfig` and `ts-node -vv` before changing settings.\n"
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm ts-node"
  ],
  [
   "Category",
   "Languages, types and runtimes"
  ],
  [
   "License",
   "MIT"
  ],
  [
   "Latest version",
   "v10.9.2, December 8, 2023"
  ],
  [
   "On GitHub since",
   "July 2015"
  ],
  [
   "Gid Score",
   "80.8"
  ],
  [
   "Rank in category",
   "#3 of 70"
  ],
  [
   "GitHub",
   "TypeStrong/ts-node"
  ],
  [
   "Last change",
   "Jul 18, 2024"
  ]
 ],
 "good": [],
 "checked_line": "From the package registry, GitHub and our scan of public agent projects; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/typestrong.png"
}