Deno version mismatch between deno.json and CI in CI
When the Deno version in CI differs from what your project targets, features present locally can be missing on the runner, producing parse errors, unsupported syntax, or changed API behavior.
What this error means
Code that runs locally fails in CI with unsupported syntax, a missing API, or an import-attributes error, and deno --version in CI shows a different version than expected.
deno
deno 1.46.3 (release, x86_64-unknown-linux-gnu)
# but the project targets v2.x; syntax such as import attributes fails
error: Import assertion type "json" not supportedCommon causes
setup-deno installed a different version
A floating or default deno-version in CI resolved to a version that does not match your local toolchain.
deno.json expects a version not present in CI
The project targets a Deno version (or feature set) the runner does not have, so behavior diverges.
How to fix it
Pin the Deno version explicitly
- Set an explicit
deno-versionin setup-deno matching your local version. - Log
deno --versionto confirm. - Re-run so local and CI agree.
.github/workflows/ci.yml
- uses: denoland/setup-deno@v2
with:
deno-version: v2.1.4Keep the target version in deno.json
Record the expected Deno version so contributors and CI stay aligned.
deno.json
{
"deno": "2.1.4"
}How to prevent it
- Pin an explicit
deno-versionin CI, not a floating tag. - Record the target Deno version in deno.json.
- Log
deno --versionso mismatches are visible.
Related guides
Deno "deno: command not found" in CI (setup-deno)Fix "deno: command not found" in CI - the runner has no Deno on PATH because the setup-deno step is missing o…
Deno "Import assertion type not supported" in CIFix Deno "error: Import assertion type ... not supported" in CI - a JSON or other import used an assertion/at…
Deno "fmt --check ... Not formatted" gate failing in CIFix Deno "error: Found N not formatted files" from deno fmt --check in CI - files do not match the formatter…