Deno npm: specifier "npm package not found" in CI
Deno tried to resolve an npm: specifier against the npm registry and got nothing. The package name is wrong, private, or the requested version does not exist.
What this error means
The run fails with "error: npm package \"pkg\" does not exist" or "Could not find npm package \"pkg\" matching ...".
deno
error: npm package "lodahs" does not exist.
at file:///home/runner/work/app/app/src/main.ts:1:19Common causes
A misspelled or private package name
The npm registry has no public package by that name (a typo), or it is private and the runner has no auth to fetch it.
A version constraint with no published release
The package exists but the requested version range has never been published to npm.
How to fix it
Correct the specifier
- Verify the exact package name and a published version on npm.
- Fix the
npm:specifier or its version range. - Re-run so resolution succeeds.
src/main.ts
import express from "npm:express@^4.19.0";Configure registry auth for private packages
For a private package, provide the npm auth token so the runner can fetch it.
.github/workflows/ci.yml
- run: deno run -A main.ts
env:
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}How to prevent it
- Verify npm package names and versions before pinning them.
- Provide registry auth in CI for private npm packages.
- Commit the lockfile so npm resolution is deterministic.
Related guides
Deno JSR "Could not find version that matches" in CIFix Deno "error: Could not find version of ... that matches" in CI - a jsr: specifier or constraint has no pu…
Deno "Failed reading lock file" / integrity mismatch in CIFix Deno lockfile errors in CI - "error: Failed reading lock file" or a deno.lock integrity mismatch when the…
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…