Skip to content

Deno

Deno is a JavaScript runtime toolchain that runs JavaScript and TypeScript files in a sandbox and ships a formatter, a linter, a test runner, and a task runner in one deno executable. Code has no file, network, or environment access until a command-line flag grants it.

Deno comes from Ryan Dahl, who also created Node.js. It’s a separate implementation, built in Rust on the V8 engine. Since Deno 2, released in October 2024, it also runs projects that have a package.json file and a node_modules folder. Another runtime toolchain for the same job is Bun.

Installation and Setup

Deno is installed once per machine. On macOS and Linux, Deno’s documentation recommends the official install script:

Language: Shell
$ curl -fsSL https://deno.land/install.sh | sh

On Windows, run this in PowerShell:

Language: Shell
PS> irm https://deno.land/install.ps1 | iex

Next, confirm the installed version:

Language: Shell
$ deno --version
deno 2.9.8 (stable, release, x86_64-unknown-linux-gnu)
v8 15.0.245.2-rusty
typescript 6.0.3

Key Features

  • Runs .ts files directly, without a separate build step.
  • Blocks file, network, and environment access unless flags such as --allow-read or --allow-net grant it.
  • Imports npm packages through npm: specifiers and runs existing projects that use package.json.
  • Formats, lints, and tests code with the built-in deno fmt, deno lint, and deno test commands.
  • Runs named scripts from the tasks field in deno.json with deno task.

Usage

Say a shop’s cart.ts script reads its items from a prices.json file and logs the order total. The --allow-read flag grants read access, so the script runs:

Language: Shell
$ deno run --allow-read cart.ts
Total: 22.5

Without the flag, Deno asks for permission in an interactive terminal. When access is refused, the read throws a NotCapable error.

The init command creates a new project with a deno.json config file, a main.ts module, and a main_test.ts test file:

Language: Shell
$ deno init shop

Inside the project folder, the test command type-checks and runs every test file:

Language: Shell
$ deno test
Check main_test.ts
running 2 tests from ./main_test.ts
returns html on / ... ok (9ms)
returns json on /api ... ok (644µs)

ok | 2 passed | 0 failed (18ms)

The tasks field in deno.json gives longer commands a short name:

Language: JSON
{
  "tasks": {
    "dev": "deno run --watch --allow-net main.ts"
  }
}

With that task defined, deno task dev starts the server and restarts it when a file changes:

Language: Shell
$ deno task dev

The fmt and lint commands format and check every file in the project:

Language: Shell
$ deno fmt
$ deno lint

For every command and flag, see the Deno documentation.

A developer standing in a doorway between a colorful JAVASCRIPT console with a browser screen and a blue JAVA server console whose robot arms hold a phone and a bank card

Tutorial

Java vs JavaScript: The Real Difference and Where to Start

Java vs JavaScript: they share a name thanks to a 1995 marketing deal, not a shared design. Here's the story, the real difference, and which to learn first.

basics js

Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.


By Leodanis Pozo Ramos • Updated Nov. 6, 2026