Skip to content
Tutorials Center
My learning

Topics

Lesson 2 of 37 ยท Getting Started

Installing Deno

Install Deno with a shell script, a package manager, npm or Docker, check the version, upgrade, set up an editor and enable shell completions on Windows, macOS and Linux.

Deno ships as a single executable file with no dependencies. There is nothing to compile and no installer wizard you must click through. You download one binary, put it on your PATH, and you are done. This lesson shows the common ways to do that, how to check that it works, how to upgrade, and how to set up your editor.

The commands below are for your own computer and are shown read-only. The runnable examples on this page are small JavaScript helpers that show how a program can detect which runtime it is in.

Install with a script

The official installer scripts download the right binary for your system and add it to your PATH.

macOS and Linux:

Terminal
curl -fsSL https://deno.land/install.sh | sh

Windows (PowerShell):

POWERSHELL
irm https://deno.land/install.ps1 | iex

The installer puts deno in ~/.deno/bin (on Windows, %USERPROFILE%\.deno\bin) and offers to edit your shell profile. Open a new terminal afterward so the new PATH is loaded.

Install with a package manager

If you already use a package manager, it is usually the easiest route because it also handles upgrades.

Terminal
# macOS or Linux with Homebrew
brew install deno

# Windows with WinGet
winget install DenoLand.Deno

# Windows with Scoop or Chocolatey
scoop install deno
choco install deno

# Any system that has Node.js
npm install -g deno

# Using asdf or mise
mise use -g deno@latest

Docker users can run Deno from an official image without installing it on the host:

Terminal
docker run --rm -it denoland/deno:latest --version

Check the installation

Run this in a terminal:

Terminal
deno --version

You should see three lines: the Deno version, the V8 engine version and the TypeScript version bundled with that release. The exact numbers depend on when you installed. Deno bundles its own TypeScript, so you do not install typescript separately.

Other quick checks:

Terminal
deno --help        # list every subcommand
deno eval "console.log(1 + 1)"
deno repl          # interactive prompt, Ctrl+D to exit

deno eval runs a snippet in one go, while deno repl opens an interactive session where you can type expressions and see the results. Both are handy for quick experiments. Your First Deno Program goes through them step by step.

Upgrading

Deno has a built-in updater, so you rarely reinstall by hand:

Terminal
deno upgrade                 # latest stable
deno upgrade --version 2.1.0 # a specific version
deno upgrade --canary        # newest development build
deno upgrade --dry-run       # show what would happen

If you installed with a package manager, upgrade with that package manager (for example brew upgrade deno) so it stays in control of the file.

Editor setup

Deno includes a language server (deno lsp) so editors can show types, errors and completions.

  • VS Code: install the official Deno extension. A project is Deno-enabled when you run the command Deno: Initialize Workspace Configuration or set "deno.enable": true in .vscode/settings.json. Without that, VS Code uses its own TypeScript server, which does not know about jsr: or URL imports.
  • JetBrains IDEs: install the Deno plugin and turn it on in Settings.
  • Neovim, Helix, Zed, Emacs: point the editor's LSP client at deno lsp.

A project-level setting is important if you work on both Node.js and Deno projects: the Deno language server should only be active in folders that really use Deno.

JSON
{
  "deno.enable": true,
  "deno.lint": true
}

Shell completions

Tab completion for subcommands and flags is one command away:

Terminal
deno completions bash > ~/.deno_completions.bash
deno completions zsh  > ~/.zsh/_deno
deno completions fish > ~/.config/fish/completions/deno.fish
deno completions powershell | Out-String | Invoke-Expression

Follow your shell's instructions for loading the file, then restart the shell.

Where Deno keeps things

Deno does not copy dependencies into every project. It downloads each remote module once and stores it in a shared cache directory. You can find it with:

Terminal
deno info

The output lists the cache location (DENO_DIR), the remote-module cache and the npm cache. To change where Deno stores its files, set the DENO_DIR environment variable. This matters in CI, where you often want to cache that folder between runs, and in Docker, where you want it inside the image.

Detecting the runtime in code

Sometimes one file needs to behave differently in Deno, Node.js or a browser. You can detect the runtime by checking for the Deno global. The helper below runs here in Node.js, but the same code works unchanged under Deno.

Node.js Which runtime am I in?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

Under Deno, Deno.version also holds the V8 and TypeScript versions as Deno.version.v8 and Deno.version.typescript.

Comparing versions

Tools often need to check "is my version new enough?". Deno publishes a semver helper in @std/semver, but the idea is simple enough to write by hand, which is a good exercise in splitting strings and comparing numbers.

Node.js Is my Deno version new enough?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

In a real Deno script you would write import { greaterOrEqual, parse } from "jsr:@std/semver@1"; and use its functions, which also handle pre-release tags.

Uninstalling

Because Deno is one binary plus a cache, removal is easy. Delete the deno executable (or run your package manager's uninstall command), then delete the cache folder shown by deno info if you want the disk space back.

Troubleshooting

  • deno: command not found: the install directory is not on PATH. Open a new terminal, or add ~/.deno/bin to your profile.
  • Old version still runs: another copy earlier on PATH wins. Run which deno (macOS/Linux) or where deno (Windows) to see which.
  • Corporate proxy: set HTTPS_PROXY so Deno can fetch remote modules.
  • VS Code shows red squiggles for jsr: imports: the Deno extension is not enabled for that folder.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which command prints the installed Deno, V8 and TypeScript versions?

    deno --version prints the three versions. deno info shows cache locations instead.
  2. 2. How do you update an installation made with the official script?

    Deno has a built-in updater, deno upgrade, that replaces the binary with a newer release.
  3. 3. Why enable the Deno extension per project instead of globally?

    In a Node.js project the Deno server would misread imports, so you enable it only where it fits.
  4. 4. Which environment variable moves Deno's cache?

    DENO_DIR controls where Deno stores downloaded modules and caches.

Summary

  • Deno is a single binary; install it with a script, a package manager, npm or Docker.
  • deno --version confirms the install and shows the bundled V8 and TypeScript versions.
  • deno upgrade updates a script-based install.
  • The editor needs the Deno extension or LSP, enabled only for Deno projects.
  • Dependencies live in a shared cache, found with deno info.
  • typeof globalThis.Deno tells a program whether it runs under Deno.

Next: Your First Deno Program