On this page

deno cache

Cache and compile remote dependencies recursively.

Command Jump to heading

deno cache [OPTIONS] <FILE> - Caches dependencies of FILE.

Synopsis Jump to heading

deno cache [--no-check[=<NO_CHECK_TYPE>]] [--import-map <FILE>] [-q|--quiet] 
[--no-remote] [--no-npm] [--node-modules-dir[=<node-modules-dir>]] [--vendor[=<vendor>]]
[-c|--config <FILE>] [--no-config] [-r|--reload[=<CACHE_BLOCKLIST>...]]
[--lock [<FILE>]] [--lock-write] [--no-lock] [--cert <FILE>] [--check[=<CHECK_TYPE>]] <FILE>

deno cache -h|--help

Description Jump to heading

Pre-download and compile remote dependencies along with their static imports, storing them in the local cache.

All of the static dependencies are saved in the local cache, without running any code. This ensures faster execution times for scripts that have already been cached by avoiding unnecessary network requests and recompilation.

Cache Location Jump to heading

Modules cached using deno cache are stored in $DENO_DIR, a centralized directory. Its location varies by OS. For instance, on macOS, it's typically /Users/user/Library/Caches/deno.

You can see the cache location by running deno info with no arguments.

Cache Invalidation Jump to heading

Future runs of this module will trigger no downloads or compilation unless the --reload option is specified.

Arguments Jump to heading

FILE - The module entrypoint.

The module entrypoint can be a local file or a remote URL. Dependencies are detected from it's imports.

Options Jump to heading

  • --no-check[=<NO_CHECK_TYPE>]

    Skip type-checking. If the value of '--no-check=remote' is supplied, diagnostic errors from remote modules will be ignored.

  • --import-map <FILE>

    Load import map file from local file or remote URL. Docs: https://docs.deno.com/runtime/manual/basics/import_maps Specification: https://wicg.github.io/import-maps/ Examples: https://github.com/WICG/import-maps#the-import-map

  • -q, --quiet

    Suppress diagnostic output

  • --no-remote

    Do not resolve remote modules

  • --no-npm

    Do not resolve npm modules

  • --node-modules-dir[=<node-modules-dir>]

    Enables or disables the use of a local node_modules folder for npm packages

    [possible values: true, false]

  • --vendor[=<vendor>]

    UNSTABLE: Enables or disables the use of a local vendor folder for remote modules and node_modules folder for npm packages

    [possible values: true, false]

  • -c, --config <FILE>

    The configuration file can be used to configure different aspects of deno including TypeScript, linting, and code formatting. Typically the configuration file will be called deno.json or deno.jsonc and automatically detected; in that case this flag is not necessary. See https://deno.land/manual@v1.41.3/getting_started/configuration_file

  • --no-config

    Disable automatic loading of the configuration file

  • -r, --reload[=<CACHE_BLOCKLIST>...]

    Reload source code cache (recompile TypeScript).

    The CACHE_BLOCKLIST is a comma separated list of arguments passed to the --reload option.

    E.g. --reload=https://deno.land/std/fs/utils.ts,https://deno.land/std/fmt/colors.ts

  • --lock [<FILE>]

    Check the specified lock file. If value is not provided, defaults to "deno.lock" in the current working directory.

  • --lock-write

    Force overwriting the lock file

  • --no-lock

    Disable auto discovery of the lock file

  • --cert <FILE>

    Load the certificate from a PEM encoded file

  • --check[=<CHECK_TYPE>]

    Enable type-checking. This subcommand does not type-check by default. If the value of '--check=all' is supplied, diagnostic errors from remote modules will be included.

    Alternatively, the 'deno check' subcommand can be used.

  • -h, --help

    Print help (see a summary with '-h')

Examples Jump to heading

  • Cache the dependencies of a module
deno cache https://deno.land/std/http/file_server.ts
  • Force a cache update
deno cache --reload https://deno.land/std/http/file_server.ts
  • Cache a known npm module
deno cache npm:express
  • Reload everything
deno cache --reload
  • Reload only standard modules
deno cache --reload=https://deno.land/std
  • Reloads specific modules
deno cache --reload=https://deno.land/std/fs/utils.ts,https://deno.land/std/fmt/colors.ts
  • Reload all npm modules
deno cache --reload=npm:
  • Reload specific npm module
deno cache --reload=npm:chalk