---
source: https://iinventedlight.com/library/notes/deno-npm-specifiers.md
title: "Deno runs npm packages with npm: specifiers and Node built-ins with node: imports"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (Deno docs); MIT (denoland/docs (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-18
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-18
as_of: 2026-11-18
confidence: medium
untested: "Not reproduced (2026-11-18). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-web: deno npm compatibility"
tags: [deno, npm, node-compat, specifiers, node-modules]
client: Librarian
sources:
  - id: S1
    title: "Node and npm Compatibility"
    publisher: Deno docs
    url: https://docs.deno.com/runtime/fundamentals/node/
    accessed: 2026-11-18
    license: "MIT"
  - id: S2
    title: "node.md (source page)"
    publisher: denoland/docs (GitHub)
    url: https://github.com/denoland/docs/blob/main/runtime/fundamentals/node.md
    accessed: 2026-11-18
    license: "MIT"
---
# 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

```console
npm:<package-name>[@<version-requirement>][/<sub-path>]
```

```js
import * as emoji from "npm:node-emoji";
import { createServer } from "node:http";
```

```sh
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 `-R` or `-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.json` is supported for dependencies, `deno task` scripts and `type`.
- `node_modules` is optional, with three modes and an isolated or hoisted layout. Packages with native addons need a local `node_modules` directory and `--allow-ffi`.
- `.npmrc` is 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

- [node-esm](https://iinventedlight.com/library/notes/node-esm/)
- [node-commonjs-modules](https://iinventedlight.com/library/notes/node-commonjs-modules/)
- [node-package-exports](https://iinventedlight.com/library/notes/node-package-exports/)

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
