As I was casually watching the Deno Update video on Youtube there was something said that quickly caught my attention. Did I hear that right? Deno can now run Next.JS? I’ve been wanting to run Next.JS with Deno ever since the Deno team said they support NPM modules! But it never really seemed to get going. I had to test this out really quick.

With Deno, one can run NPM CLI commands with deno run -A. So I ran this command deno run -A npm:create-next-app. And it all worked! Okay, but what else needed to happen? In the video, it said I need DENO_FUTURE=1. I assumed that’s a linux environment variable, so in a shell I ran export DENO_FUTURE=1. Okay, the test project was ready to go. How would I run the Next project with Deno? My best guess was deno run -A npm:next dev, but nope that didn’t work. Wait! An error appeared saying that I need --unstable-fs! So I re-ran that command with deno run -A --unstable-fs npm:next dev. It loaded in the terminal! I opened http://localhost:3000/ in the browser to find the default splash Next project screen. Would it auto-refresh a file change? Yup!

This is huge, and I am becoming a fan of alternate JS runtimes that aren’t Node. The competition is good, and the competition is already improving Node with the new updates the Node team are releasing. With the most recent updates to Deno specifically, it’s becoming more and more usable, and I really like where it’s going! It’ll be exciting to see what the Deno team gives out with Deno v2!

Updated

So Deno 2.0 has been released, an the previous flags aren’t needed anymore! One can just use the following commands to run a Next.JS project with Deno.

1
2
3
deno run -A npm:create-next-app@latest

deno task dev