Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Deno 6 min read Opinion easyNovice

Why We Added package.json Support to Deno

Deno added package.json support because its HTTP-import module system, though decentralized and manifest-free, suffers from the Duplicate Dependency Problem, the clunky deps.ts pattern, non-composable import maps, and the limits of transpile servers like esm.sh. Bare specifiers with semver resolution solve deduplication, so Deno now runs existing Node projects while keeping safeguards such as node: prefixes, no arbitrary post-install scripts and permission enforcement. The next major release plans a deno: URL scheme with semver resolution (e.g. deno:oak@12) and encourages import maps in deno.json that mix deno: and npm: specifiers.

Assumes: JavaScript ES modulesnpm and package.jsonsemantic versioning

Related posts

  • What we got wrong about HTTP imports

    Deno easyNovice

    Deno's original module system of direct HTTP URL imports didn't scale. Long URLs cluttered code, `deps.ts` files were clumsy, exact version pinning in URLs led to duplicate copies of the same library, and builds depended on the uptime of every host in the dependency graph. Deno is keeping HTTP imports but now recommends import maps for short specifiers and central version management, plus JSR, a semver-aware registry that resolves `jsr:` specifiers to immutable HTTP URLs. That design keeps granular file downloads and fixes deduplication and reliability. These changes are a core part of Deno 2.

  • If you're not using npm specifiers, you're doing it wrong

    Deno mediumAdept

    Deno now recommends importing npm packages with native `npm:` specifiers instead of HTTP transpile services like esm.sh or unpkg. Those services lack semver-aware deduplication, so duplicate copies of React can load, and they can't run install hooks for native add-ons or serve bundled data files. Native `npm:` imports resolve versions properly and need no node_modules or package.json, since packages go to a global cache. They also work in Jupyter and the REPL, fall under Deno's permission model with opt-in `--allow-scripts`, and support private registries via `.npmrc`.

  • Deno 1.31: package.json support

    Deno mediumAdept

    Deno 1.31 adds automatic package.json detection, so dependencies resolve from bare specifiers and package.json scripts run via deno task (simple scripts only for now). The Node.js compatibility layer, roughly 1.5MB that previously lived in std/node, is now embedded in the runtime and loaded from V8 snapshots to cut startup time. Node-API is stabilized, and npm specifiers now work in remote modules without --unstable. FFI pointers become opaque objects or null instead of numbers, which speeds up calls through V8 Fast API, makes pointer spoofing harder and requires migration. Deno.Command is now stable, deno bundle is deprecated, and deno bench gains JSON output.

  • Introducing your new JavaScript package manager: Deno

    Deno mediumAdept

    Deno 2 adds `deno add`, `deno remove`/`uninstall`, and `deno install` subcommands that manage npm and JSR dependencies in either `deno.json` import maps or an existing `package.json`, so they work inside Node projects too. Installs use a global cache with hard links (Linux) or clonefile (macOS), like pnpm, to save disk space and speed up installs, and `--entrypoint` can pre-cache dependencies for Docker builds. Postinstall scripts are blocked by default and must be allowed per package with `--allow-scripts`. `deno outdated` and `deno update` are planned for the next release.

  • Deno 1.28: Featuring 1.3 Million New Modules

    Deno mediumAdept

    Deno 1.28 stabilizes npm compatibility, letting programs import any of npm's 1.3 million packages via `npm:` specifiers in imports or import maps, and run npm CLIs with `deno run npm:<pkg>`, with no package.json, install step or node_modules folder by default. Deno's opt-in permission prompts restrict what npm dependencies can access, though post-install scripts, `deno compile` and some Node-layout assumptions remain unsupported. The release also auto-discovers and additively updates a `deno.lock` file whenever a deno.json config exists, stabilizes APIs such as `Deno.bench()` and `Deno.networkInterfaces()`, adds an unstable unified `Deno.Command` subprocess API replacing the `Deno.spawn` family, and upgrades to V8 10.9.

The quest for software engineering knowledge.

Look:
Layout: