Practical Linux, Windows Server and cloud guides for IT pros.

How to Install TypeScript on Windows, macOS and Linux

Installing TypeScript always starts with the same building blocks: install Node.js, confirm that npm works, then install the TypeScript compiler and verify it with tsc -v. The exact commands vary by operating system, so this page is the central guide for choosing the right walkthrough.

Filed under

Published

Written by

Last updated

TL;DR

  • TypeScript installs on Node.js — get Node first, then npm install -g typescript for global, or npm install --save-dev typescript for project-local.
  • Verify with tsc -v; bootstrap a project with npx 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.json keeps 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

PlatformTypical Node.js sourceBest forWatch out for
WindowsNode.js MSI installer or wingetDeveloper workstations, VS Code, PowerShell usersPATH not refreshed in current shell after install — open a fresh terminal
macOSHomebrew or Node.js installerMac developer laptops, both Apple Silicon and IntelHomebrew prefix differs between Apple Silicon (/opt/homebrew) and Intel (/usr/local)
Linux (Ubuntu / Debian)apt or NodeSource repoServers, containers, dev workstationsDistro nodejs package often lags — use NodeSource for current LTS
Linux (RHEL / Rocky / Alma)dnf or NodeSourceEnterprise servers, RHEL fleetsDefault 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.

  1. Install Node.js and npm. Confirm with node -v and npm -v. The Node.js LTS line is the right default; avoid Current unless you specifically need a feature only on the latest release.
  2. Install TypeScript. Globally with npm install -g typescript for system-wide use, or project-locally with npm install --save-dev typescript inside an existing project directory. Project-local is the better default — see the next section.
  3. Verify the compiler. tsc -v for global installs, or npx tsc -v for project-local installs. The output is just Version X.Y.Z.
  4. Bootstrap a project. npx tsc --init in a project directory generates a starter tsconfig.json. Compile a single file with npx tsc index.ts, or run npx tsc on its own to compile every file referenced by tsconfig.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 running tsc outside 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 in package.json, so every developer and every CI run uses the same version. Invoke via npx tsc, or via npm scripts ("build": "tsc" in package.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) or npx 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”).

Elsewhere On TurboGeek:  How to Install TypeScript on Windows: Step-by-Step Guide

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

Leave a Reply

Your email address will not be published. Required fields are marked *

Find more on the site

Keep reading by topic.

If this post was useful, the fastest way to keep going is to pick the topic you work in most often.

Want another useful post?

Browse the latest posts, or support TurboGeek if the site saves you time regularly.

Translate »