Skip to content
Latchkey

Deno "imports" Map Bare Specifier Not Found in CI

Deno could not resolve a bare import specifier because it is not in the imports map of deno.json. Without a mapping, Deno does not know what URL or package import x from "lib" refers to.

What this error means

A module fails to load with a relative-import or unmapped-specifier error for a bare name like "@std/assert" or "lib". It works when the imports map is present and fails when the key is missing or misspelled.

deno output
error: Relative import path "lib/util" not prefixed with / or ./ or ../
  and not in import map from "file:///app/main.ts"
    at file:///app/main.ts:1:20

Common causes

Bare specifier not mapped

Deno only resolves a bare specifier if imports maps it to a URL/path/package. A missing or misspelled key leaves it unresolvable.

Wrong config loaded

If Deno loaded a different deno.json (subdirectory, --config mismatch), the import map you edited may not be the one in effect.

How to fix it

Add the specifier to the imports map

Map the bare name to its source (JSR/npm/URL/path).

deno.json
// deno.json
{
  "imports": {
    "@std/assert": "jsr:@std/assert@^1.0.0",
    "lib/": "./src/lib/"
  }
}

Confirm the active config

Verify which config Deno uses and pass it explicitly in CI.

Terminal
deno info main.ts            # shows resolved imports
deno run --config ./deno.json main.ts

How to prevent it

  • Keep all bare specifiers mapped in a committed deno.json.
  • Use deno info to verify resolution before pushing.
  • Pass --config in CI when running outside the project root.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →