Deno "Cannot resolve module ... offline" in CI
Deno needed to download a remote module but the network was unreachable and the module was not in DENO_DIR. In CI this is usually a blocked egress, a proxy, or a cache that was not restored.
What this error means
The run fails with "error: Cannot resolve module \"https://...\"" or "error: Import ... failed: error sending request" when fetching a remote specifier.
deno
error: Import "https://deno.land/std@0.224.0/path/mod.ts" failed: error sending request for url (https://deno.land/std@0.224.0/path/mod.ts): client error (Connect)Common causes
Blocked or proxied network egress
The runner cannot reach the remote host directly (firewall or required proxy), so the fetch fails.
No restored cache to fall back on
DENO_DIR was not restored, so Deno has no local copy and must reach the network, which is unavailable.
How to fix it
Restore the cache or allow egress
- Restore DENO_DIR so remote modules are available offline.
- Or configure the proxy the runner needs to reach the host.
- Re-run so resolution succeeds.
Terminal
export HTTP_PROXY=http://proxy.internal:3128
export HTTPS_PROXY=http://proxy.internal:3128
deno cache main.tsVendor or pre-cache dependencies
Populate DENO_DIR in a network-enabled step, then run the offline step against the restored cache.
.github/workflows/ci.yml
- run: deno cache main.ts
- uses: actions/cache/save@v4
with:
path: ~/.cache/deno
key: deno-${{ hashFiles('deno.lock') }}How to prevent it
- Restore DENO_DIR so remote modules do not need refetching.
- Configure required proxies for runners without direct egress.
- Pre-cache or vendor dependencies before offline steps.
Related guides
Deno "Could not find ... in cache" with --cached-only in CIFix Deno "error: Could not find ... in cache" under --cached-only / --frozen in CI - a dependency was never c…
Deno DENO_DIR cache not restored (slow re-download) in CIFix slow Deno CI runs caused by DENO_DIR not being cached - every job re-downloads and re-checks all remote a…
Deno "error: Module not found" in CIFix Deno "error: Module not found ..." in CI - Deno resolved an import specifier to a location that does not…