Deno runs npm packages with npm: specifiers and Node built-ins with node: imports
Answer: Import an npm package with an npm: prefix, such as import as emoji from "npm:node-emoji";, and Node built-ins with a node: prefix, such as import as os from "node:os";. Deno downloads the package on first run and stores it in a global cache. Dependencies can also go in package.json or the imports map of deno.json.
Specifier format
npm:<package-name>[@<version-requirement>][/<sub-path>]
import * as emoji from "npm:node-emoji";
import { createServer } from "node:http";
deno run --allow-net main.mjs
Rules to know
- The permission system applies to npm packages the same as the rest of your code: grant
-Ror-E(or answer the permission prompts) if a package reads files or environment variables. - Deno provides Node's built-in APIs through a compatibility layer. Bare imports work too: since Deno 2.9,
import * as os from "os"resolves to the Node built-in without the prefix. package.jsonis supported for dependencies,deno taskscripts andtype.node_modulesis optional, with three modes and an isolated or hoisted layout. Packages with native addons need a localnode_modulesdirectory and--allow-ffi..npmrcis supported for private registries, auth tokens and mTLS.
How compatible is it
Over 75% of Node's own test suite passes in Deno as of Deno 2.8, covering nearly every node: module. Most pure-JavaScript npm packages work without changes, but some APIs are partial.
See also
Claims
- id: C1 claim: npm packages are imported with an npm: prefix. source: S2 evidence: "import it with an
npm:prefix and run the file"
- id: C2 claim: Deno stores downloaded packages in a global cache. source: S2 evidence: "Deno downloads the package on first run and stores it in a global cache"
- id: C3 claim: Node built-ins come through a compatibility layer. source: S1 evidence: "Deno provides Node's built-in APIs through a compatibility layer."
Sources
- [S1] Node and npm Compatibility. Deno docs. https://docs.deno.com/runtime/fundamentals/node/ . License: MIT. Accessed 2026-11-18.
- [S2] node.md (source page). denoland/docs (GitHub). https://github.com/denoland/docs/blob/main/runtime/fundamentals/node.md . License: MIT. Accessed 2026-11-18.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Deno docs, Node and npm Compatibility; denoland/docs (GitHub), node.md (source page). MIT (https://raw.githubusercontent.com/denoland/docs/main/LICENSE). Copyright the Deno authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Deno docs, Node and npm Compatibility; denoland/docs (GitHub), node.md (source page). MIT (https://raw.githubusercontent.com/denoland/docs/main/LICENSE). Copyright the Deno authors.
Cite this
iinventedlight. 2026. "Deno runs npm packages with npm: specifiers and Node built-ins with node: imports." iinventedlight Library, iil:note:fq83y33g, version of 2026-11-18. https://iinventedlight.com/library/notes/deno-npm-specifiers/. License: CC-BY-4.0.
@misc{iil_note_fq83y33g,
author = {{iinventedlight}},
title = {{Deno runs npm packages with npm: specifiers and Node built-ins with node: imports}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/deno-npm-specifiers/},
note = {Permanent ID iil:note:fq83y33g. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- deno-npm-specifiers.table.json (table; CC-BY-4.0)
- deno-npm-specifiers.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/deno-npm-specifiers.md.