Skip to content
Home / Migrations / Node.jsDeno 2

Node.js Deno 2

medium

Deno 2 is Node-compatible: npm packages work, node: builtins work, package.json supported. Migration is mostly removing boilerplate and fixing path imports.

Estimated: 4-12h · 7 steps
Progress0%
Step 1: Install Deno 2
curl -fsSL https://deno.land/install.sh | sh
Step 2: Run Node project directly

Try running your entry point — Deno 2 reads package.json and resolves npm deps automatically.

deno run --allow-all src/index.ts
Step 3: Fix import extensions

Deno requires explicit .ts extensions in local imports: import './utils' → import './utils.ts'.

Step 4: Update std library usage

Node built-ins still work via node: prefix. Deno's own std is at jsr:@std/. Use JSR for new dependencies where available.

Step 5: Replace process with Deno APIs

process.env → Deno.env.get(). process.exit() → Deno.exit(). __dirname → import.meta.dirname.

Step 6: Set up deno.json

Add deno.json for tasks, permissions, import aliases. Replaces package.json scripts for Deno-native workflow.

{ "tasks": { "dev": "deno run --watch --allow-all src/index.ts" } }
Step 7: Verify with lint + test
deno lint && deno test
All tests pass under Deno runtime

What this migration involves

Moving from Node.js to Deno 2 is rated medium and takes about 4-12h on a typical project. The guide breaks it into 7 steps, 4 of which ship with runnable commands and 1 with a verification check.

FAQ

How long does migrating from Node.js to Deno 2 take?

Around 4-12h for a typical project — 7 steps, difficulty rated medium, 4 of them with copy-paste commands.

Is moving from Node.js to Deno 2 reversible?

No reverse guide is tracked yet, so treat this as a one-way move and keep a full export of your Node.js data before you start.

What does Deno 2 cost compared to Node.js?

Pricing for both tools is contact-based or not tracked yet.