Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions runtime/reference/cli/add.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,24 @@ Add packages from JSR and npm:
deno add @std/path npm:express
```

Starting in Deno 2.8, **unprefixed names default to the npm registry**, since
npm is by far the most common source. Explicit `npm:` and `jsr:` prefixes
always take precedence:

```sh
# Resolves from npm by default
deno add express react

# Mixed sources still work with explicit prefixes
deno add express jsr:@std/async
```

To resolve unprefixed names from JSR instead, pass `--jsr`:

```sh
deno add --jsr @std/path
```

By default, dependencies are added with a caret (`^`) version range. Use
`--save-exact` to pin to an exact version:

Expand All @@ -31,12 +49,6 @@ deno add --save-exact @std/path
This saves the dependency without the `^` prefix (e.g., `1.0.0` instead of
`^1.0.0`).

Treat unprefixed package names as npm packages:

```sh
deno add --npm express
```

## Where dependencies are stored

If your project has a `package.json`, npm packages will be added to
Expand Down
9 changes: 9 additions & 0 deletions runtime/reference/cli/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ Use this command to install particular packages and add them to `deno.json` or
deno install jsr:@std/testing npm:express
```

Starting in Deno 2.8, unprefixed names default to npm:

```sh
deno install express react jsr:@std/async
```

Use `--jsr` to resolve unprefixed names from JSR instead. Explicit `npm:` and
`jsr:` prefixes always win.

:::tip

You can also use `deno add` which is an alias to `deno install [PACKAGES]`
Expand Down