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)
@aiden-f-dsouza▲ -6 net votes
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).