togakangarooT
Denoβ€’15mo ago
togakangaroo

How to note require the node: prefix

deno 2.0.3 (stable, release, x86_64-unknown-linux-gnu)
v8 12.9.202.13-rusty
typescript 5.6.2

I'm trying to see if I can run some part of our existing node codebase in deno for the jupyter compatability and at this point am down to this issue - our code doesn't use the node: specifier.

I am not looking to move everything over to Deno (big codebase, loads of devs, etc) just to use it as an alternate runtime for doing certain things.

I see mentions of node-compat mode in the past, and even more recent posts about how you can do this, and how it already happens within npm packages.

Can I actually do it within my code however? I no longer see any flags for it
$ ~/.deno/bin/deno eval --unstable-sloppy-imports "import { existsSync } from 'fs"
error: Relative import path "fs" not prefixed with / or ./ or ../
  hint: If you want to use a built-in Node module, add a "node:" prefix (ex. "node:fs").
Was this page helpful?