TL;DR
- TypeScript installs on Node.js — get Node first, then
npm install -g typescriptfor global, ornpm install --save-dev typescriptfor project-local. - Verify with
tsc -v; bootstrap a project withnpx tsc --init. - Pick the OS-specific guide for the tooling that fits your machine (winget, Homebrew, apt/dnf).
- Project-local is the right default for any real project — pinning the version in
package.jsonkeeps teams aligned.
What is TypeScript?
TypeScript is a typed superset of JavaScript developed by Microsoft. It compiles down to plain JavaScript that runs anywhere JavaScript runs — browsers, Node.js, serverless functions — but gives you static type checking, modern language features and proper editor tooling along the way. In 2026 it’s the default language of choice for serious JavaScript work; React, Vue, Next.js, Angular, NestJS and most modern Node frameworks ship with TypeScript-first templates.
The compiler is distributed as a Node.js package called typescript. That means installation always reduces to one prerequisite — a working Node.js plus npm — followed by one command to add the compiler. The variations between operating systems are entirely about how you get Node.js itself onto the machine.
Pick the guide for your platform
This page is the index. The deep installation walkthroughs live in three OS-specific posts, each with the exact commands, common pitfalls, and verification steps for that environment.
Windows
Use How to Install TypeScript on Windows. Covers the Node.js MSI installer, winget install OpenJS.NodeJS.LTS, PowerShell vs Command Prompt usage, and Visual Studio Code integration. Best path for developer workstations and Windows-first teams.
macOS
Use How to Install TypeScript on macOS. Covers Homebrew (brew install node), the official Node.js installer, and the small differences between Apple Silicon and Intel Macs. Best path for developer laptops.
Linux
Use How to Install TypeScript on Linux. Covers apt on Ubuntu/Debian, dnf on RHEL/Rocky/Alma, NodeSource binary distributions, and nvm for managing multiple Node versions. Best path for servers, cloud VMs, containers and developer workstations.
Quick comparison: install paths by platform
| Platform | Typical Node.js source | Best for | Watch out for |
|---|---|---|---|
| Windows | Node.js MSI installer or winget | Developer workstations, VS Code, PowerShell users | PATH not refreshed in current shell after install — open a fresh terminal |
| macOS | Homebrew or Node.js installer | Mac developer laptops, both Apple Silicon and Intel | Homebrew prefix differs between Apple Silicon (/opt/homebrew) and Intel (/usr/local) |
| Linux (Ubuntu / Debian) | apt or NodeSource repo | Servers, containers, dev workstations | Distro nodejs package often lags — use NodeSource for current LTS |
| Linux (RHEL / Rocky / Alma) | dnf or NodeSource | Enterprise servers, RHEL fleets | Default repo lags further than Ubuntu’s; NodeSource is the practical choice |
The shared install flow (what every guide does)
Whichever OS guide you follow, the structure is the same four-step flow. The OS-specific guides cover step 1 in depth (because that’s where the variation lives) and confirm steps 2–4 work the same way everywhere.
- Install Node.js and npm. Confirm with
node -vandnpm -v. The Node.js LTS line is the right default; avoid Current unless you specifically need a feature only on the latest release. - Install TypeScript. Globally with
npm install -g typescriptfor system-wide use, or project-locally withnpm install --save-dev typescriptinside an existing project directory. Project-local is the better default — see the next section. - Verify the compiler.
tsc -vfor global installs, ornpx tsc -vfor project-local installs. The output is justVersion X.Y.Z. - Bootstrap a project.
npx tsc --initin a project directory generates a startertsconfig.json. Compile a single file withnpx tsc index.ts, or runnpx tscon its own to compile every file referenced bytsconfig.json.
Global vs project-local TypeScript
The single most useful decision when installing TypeScript is whether to install it globally (one copy on the machine, available to every shell) or project-locally (a copy inside node_modules for a specific project, pinned via package.json). Both work; they’re for different jobs.
- Global (
npm install -g typescript) — convenient for ad-hoc one-file scripts, learning, or quickly runningtscoutside any project. The compiler version is whatever was installed last; teams that share machines can drift apart silently. - Project-local (
npm install --save-dev typescript) — the right default for any real project. The compiler version is pinned inpackage.json, so every developer and every CI run uses the same version. Invoke vianpx tsc, or via npm scripts ("build": "tsc"inpackage.json). - Both — you can have one of each. The project-local copy wins inside the project directory; the global copy is available everywhere else.
If you’re just getting started and want to play, install globally. If you’re starting a project you intend to keep, install project-local from day one and use npx tsc consistently. Mixed teams that switch between the two are the most common source of “works on my machine” TypeScript errors.
Verification
Sanity-check that everything is wired up before you write code:
node -v— confirms Node.js is on the path. Anything 18.x or later is fine in 2026; 20.x or 22.x LTS are the safest defaults.npm -v— confirms npm is installed alongside Node.js (it is, by default).tsc -v(global) ornpx tsc -v(project-local) — prints the TypeScript compiler version.echo 'const x: string = "ok"; console.log(x);' > test.ts && npx tsc test.ts && node test.js— end-to-end smoke test. Compiles a one-line TypeScript file and runs the resulting JavaScript.
Troubleshooting common install issues
tsc: command not found after a global install — the install succeeded but the npm global bin directory isn’t on your PATH. Run npm config get prefix; the binaries live in $prefix/bin. Add that directory to PATH in your shell profile, or open a fresh terminal if the install just completed.
EACCES: permission denied on global install — npm’s default global directory needs sudo on some systems. The right fix is not sudo npm install -g but to point npm at a user-owned directory: npm config set prefix ~/.npm-global, then add ~/.npm-global/bin to PATH.
Wrong TypeScript version inside a project — global install is shadowing the project-local one. Always use npx tsc inside projects, or invoke ./node_modules/.bin/tsc directly. Editor integrations often have a “Use Workspace Version” toggle (VS Code: command palette → “TypeScript: Select TypeScript Version”).
Cannot find module '@types/node' — TypeScript doesn’t know about Node.js’s built-in modules unless you install the type definitions: npm install --save-dev @types/node.
Compile succeeds but runtime imports fail — usually a module setting mismatch in tsconfig.json. "module": "CommonJS" for Node, "module": "ESNext" for modern bundlers. The wrong combination produces JavaScript Node can’t require().
Authoritative sources
The canonical references are typescriptlang.org — Download, nodejs.org (for Node.js itself, the prerequisite), and the npm CLI documentation for the install commands. The TypeScript release notes on GitHub are the source of truth for what’s new in each version.
Related reading
- How to Install TypeScript on Windows — the deep guide for Windows machines
- How to Install TypeScript on macOS — the deep guide for Mac developers
- How to Install TypeScript on Linux — the deep guide for servers, containers and Linux desktops
- How to install Docker on Ubuntu — for containerised TypeScript / Node.js builds
- How to write the perfect AGENTS.md file — for AI-coding-friendly TypeScript projects
- Cursor vs Claude Code — both lean heavily on TypeScript-aware tooling
- AI Workflows Start Here — the wider AI-coding tutorial hub

Leave a Reply