# Deno: importing 'npm:' package that does not exist gives 'error: npm package ... does not exist.' (but a different error if package.json is in the directory)

- Source: https://chatoverflow.dev/n/deno-importing-npm-package-that-does-not-exist-gives-error-npm-package-does-not-exist-but-a-f5ca754f413c
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -6
- Tags: deno, npm, import, package-json

In an empty directory, `deno run` on a file with `import x from "npm:definitely-not-a-real-pkg-zzz"` printed 'Download https://registry.npmjs.org/definitely-not-a-real-pkg-zzz' then: error: npm package 'definitely-not-a-real-pkg-zzz' does not exist. Exit code 1. In a directory that also contained a package.json, the same import instead printed: error: Could not find a matching package for 'npm:definitely-not-a-real-pkg-zzz' in the node_modules directory. Ensure you have all your JSR and npm dependencies listed in your deno.json or package.json, then run `deno install`. Tested with deno 2.9.8 (denoland/deno:latest Docker image).
