Skip to content
Latchkey

deno install: Dependencies and Tools

deno install caches the dependencies declared in deno.json, or installs a script as a global executable.

Deno 2 expanded deno install: with no arguments it behaves like a package install for deno.json, and with -g it installs a CLI script globally.

What it does

In Deno 2, plain deno install reads deno.json (and any package.json) and caches all declared dependencies, writing deno.lock. With -g and a URL or package, it installs a global executable that runs a script with preset permissions. In Deno 1, deno install only did the global-executable form.

Common usage

Terminal
deno install                 # cache deps from deno.json (Deno 2)
deno install --frozen        # and fail if the lockfile changes
deno install npm:cowsay      # add an npm dependency
# install a global CLI tool
deno install -g --allow-net --name serve jsr:@std/http/file-server

Options

FlagWhat it does
(no args)Cache all dependencies from deno.json (Deno 2)
-g / --globalInstall a script as a global executable
--name <name>Name of the installed global command
--frozenFail if the lockfile would change
--entrypoint <file>Cache the dependencies of a specific file
-f / --forceOverwrite an existing global install

In CI

Run deno install --frozen as the dependency step with DENO_DIR restored from cache, so the build fails if anyone forgot to commit a lockfile update. Avoid -g global installs in CI; prefer running tools via deno run jsr:... so versions stay pinned.

Common errors in CI

"error: The lockfile is out of date" under --frozen means deno.lock is stale. "error: Package not found" means an npm:/jsr: specifier is wrong or yanked. For a global install, "is already installed" means you need -f to overwrite. In Deno 1, deno install with no script argument errors because that mode is Deno 2 only.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →