{"record":{"id":"97025bc12d3309e1","repo":"denoland/deno","slug":"couldn-t-find-a-deno-json-deno-jsonc-jsr-json-or","errorCode":null,"errorMessage":"Couldn't find a deno.json, deno.jsonc, jsr.json or jsr.jsonc configuration file in {}.","messagePattern":"Couldn't find a deno\\.json, deno\\.jsonc, jsr\\.json or jsr\\.jsonc configuration file in (.+?)\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/tools/publish/mod.rs","lineNumber":103,"sourceCode":"  let directory_path = cli_options.initial_cwd();\n  let mut publish_configs = cli_options.start_dir.jsr_packages_for_publish();\n  if publish_configs.is_empty() {\n    match cli_options.start_dir.member_deno_json() {\n      Some(deno_json) => {\n        debug_assert!(!deno_json.is_package() || !deno_json.should_publish());\n        if deno_json.json.name.is_none() {\n          bail!(\"Missing 'name' field in '{}'.\", deno_json.specifier);\n        }\n        if !deno_json.should_publish() {\n          bail!(\n            \"Package 'publish' field is false in '{}'.\",\n            deno_json.specifier\n          );\n        }\n        error_missing_exports_field(deno_json)?;\n      }\n      None => {\n        bail!(\n          \"Couldn't find a deno.json, deno.jsonc, jsr.json or jsr.jsonc configuration file in {}.\",\n          directory_path.display()\n        );\n      }\n    }\n  }\n\n  if let Some(version) = &publish_flags.set_version {\n    if publish_configs.len() > 1 {\n      bail!(\n        \"Cannot use --set-version when publishing a workspace. Change your cwd to an individual package instead.\"\n      );\n    }\n    if let Some(publish_config) = publish_configs.get_mut(0) {\n      let mut config_file = publish_config.config_file.as_ref().clone();\n      config_file.json.version = Some(version.clone());\n      publish_config.config_file = Arc::new(config_file);\n    }","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/denoland/deno/blob/f7822238cab635a3a19f99f493f675fa81a7f9d8/cli/tools/publish/mod.rs#L85-L121","documentation":"`deno publish` discovers what to publish from a deno.json, deno.jsonc, jsr.json or jsr.jsonc in the start directory. This error is the `None` arm of the member-config lookup: `jsr_packages_for_publish()` returned no publishable packages and the start directory itself has no deno.json at all, so publish has nothing to work with. The `{}` in the message is the directory Deno was invoked from (the initial cwd).","triggerScenarios":"Running `deno publish` in a directory with no deno.json/jsr.json of any kind — e.g. a source subdirectory (src/, lib/) of a package whose config sits at the package root, a package.json-only npm project, or a fresh folder. Concretely `cli_options.start_dir.jsr_packages_for_publish()` is empty and `start_dir.member_deno_json()` returns `None`.","commonSituations":"cd-ing into a subfolder before publishing; CI jobs whose working-directory points at a subfolder while deno.json lives at the repo root or package root; config accidentally renamed (deno.config.json, deno.json.txt); running publish in a folder that only holds test fixtures.","solutions":["Run `deno publish` from the directory that contains the package's deno.json (or pass `--cwd <package-dir>`), or from the workspace root where member configs are discovered.","If this folder is meant to be a package, create a deno.json with `name`, `version`, and `exports`.","If the package is a workspace member, publish from the member directory so `jsr_packages_for_publish()` resolves it."],"exampleFix":"# before: no config in cwd\ncd packages/foo/src && deno publish   # error\n# after: run from the package root (or point --cwd at it)\ncd .. && deno publish\n# or: deno publish --cwd packages/foo","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\nset -eu\nfor f in deno.json deno.jsonc jsr.json jsr.jsonc; do\n  [ -f \"$f\" ] && exit 0\ndone\necho \"no deno/jsr config in $(pwd) — run publish from the package root\" >&2\nexit 1","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Invoke `deno publish` only from the directory containing deno.json; in CI set `working-directory:` to that folder or pass `--cwd`.","Keep the config at the package root, not in src/ or scripts/.","Add a pre-publish CI step that fails fast when no config file exists in the job's working directory."],"tags":["publish","deno-json","jsr","config","cwd"],"backgroundTag":"missing-config-file","analyzedSha":"f7822238cab635a3a19f99f493f675fa81a7f9d8","analyzedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-08-31T04:17:50.494Z"}