Skip to main content
On this page

deno add

Command line usage:
deno add [OPTIONS] [packages]...

Add dependencies to your configuration file.

deno add jsr:@std/path

You can also add npm packages:

deno add npm:react

Or multiple dependencies at once:

deno add jsr:@std/path jsr:@std/assert npm:chalk

Options Jump to heading

--allow-scripts Jump to heading

Allow running npm lifecycle scripts for the given packages Note: Scripts will only be executed when using a node_modules directory (--node-modules-dir).

--dev Jump to heading

Short flag: -D

Add the package as a dev dependency. Note: This only applies when adding to a package.json file.

--jsr Jump to heading

assume unprefixed package names are jsr packages.

--lockfile-only Jump to heading

Install only updating the lockfile.

--npm Jump to heading

assume unprefixed package names are npm packages.

--save-exact Jump to heading

Save exact version without the caret (^).

Dependency management options Jump to heading

--frozen Jump to heading

Error out if lockfile is out of date.

--lock Jump to heading

Check the specified lock file. (If value is not provided, defaults to "./deno.lock").

--no-lock Jump to heading

Disable auto discovery of the lock file.

The deno add command adds dependencies to your project's configuration file. It is an alias for deno install [PACKAGES].

Examples Jump to heading

Add packages from JSR and npm:

deno add @std/path npm:express

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

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:

deno add --npm express

Where dependencies are stored Jump to heading

If your project has a package.json, npm packages will be added to dependencies in package.json. Otherwise, all packages are added to the imports field in deno.json.

Did you find what you needed?

Privacy policy