denoland/deno · error
No deno.json or package.json in "{}".
Error message
No deno.json or package.json in "{}". What it means
The dependency-listing path of the package manager (cli/tools/pm/list.rs) requires a deno.json or package.json in the start directory; `has_deno_or_pkg_json()` returned false. Without any manifest there are no dependencies to resolve, list, or update, so it fails fast with the inspected directory path.
Source
Thrown at cli/tools/pm/list.rs:330
allow_remote: true,
cache_setting: CacheSetting::RespectHeaders,
download_log_level: log::Level::Trace,
progress_bar: None,
},
);
let file_fetcher = Arc::new(file_fetcher);
let npm_fetch_resolver = Arc::new(NpmFetchResolver::new(
file_fetcher.clone(),
factory.npmrc()?.clone(),
factory.npm_version_resolver()?.clone(),
));
let jsr_fetch_resolver = Arc::new(JsrFetchResolver::new(
file_fetcher.clone(),
factory.jsr_version_resolver()?.clone(),
));
if !cli_options.start_dir.has_deno_or_pkg_json() {
bail!(
"No deno.json or package.json in \"{}\".",
cli_options.initial_cwd().display(),
);
}
let args = DepManagerArgs {
module_load_preparer: factory.module_load_preparer().await?.clone(),
jsr_fetch_resolver,
npm_fetch_resolver,
npm_resolver: factory.npm_resolver().await?.clone(),
npm_installer: factory.npm_installer().await?.clone(),
npm_version_resolver: factory.npm_version_resolver()?.clone(),
progress_bar: factory.text_only_progress_bar().clone(),
permissions_container: factory.root_permissions_container()?.clone(),
main_module_graph_container: factory
.main_module_graph_container()
.await?
.clone(),View on GitHub (pinned to 9ad36f7a2c)
Solutions
- cd to the project root (or the directory containing deno.json/package.json) and re-run.
- Initialize a manifest: `deno init` (deno.json) or `npm init` / create a minimal deno.json.
- If the config lives elsewhere, point at it explicitly with `--config path/to/deno.json` from the current directory.
Example fix
# before (cwd has no config) deno install # after cd /path/to/project-root deno install # or point at the config deno install --config /path/to/project-root/deno.json
Defensive patterns
Strategy: validation
Validate before calling
import { existsSync } from "node:fs";
if (!existsSync("deno.json") && !existsSync("deno.jsonc") && !existsSync("package.json")) {
console.error(`no deno.json or package.json in ${process.cwd()}`);
process.exit(1);
} Prevention
- cd to the project root before running dependency commands.
- Pass --config when operating on a project from another directory.
- Initialize a manifest (deno init) before managing dependencies.
When it happens
Trigger: Running a dependency command (e.g. `deno install` in its list/resolve flow) from a directory with no deno.json and no package.json — including subdirectories of the project that contain no config.
Common situations: Wrong terminal cwd (deep src/ subfolder); fresh projects not yet initialized; running inside a scratch folder; scripts that cd into temp dirs before invoking deno.
Related errors
- Failed to discover the newly created deno.json at "{}". This
- No deno.json found in current directory
- unsupported 'exports' shape in deno.json: expected a string
- Missing name in config
- Couldn't find a deno.json, deno.jsonc, jsr.json or jsr.jsonc
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/a5ccf22340143c9f.
Report an issue: GitHub.