{"record":{"id":"1b53ab0640808987","repo":"zed-industries/zed","slug":"npm-package-name-declares-no-executable","errorCode":null,"errorMessage":"npm package {name} declares no executable","messagePattern":"npm package (.+?) declares no executable","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/node_runtime/src/node_runtime.rs","lineNumber":1061,"sourceCode":"    file.read_to_string(&mut contents).await?;\n    let package_json: PackageJson = serde_json::from_str(&contents)\n        .with_context(|| format!(\"parsing {}\", package_json_path.display()))?;\n\n    let relative_path = match package_json.bin {\n        Some(Bin::Path(path)) => path,\n        Some(Bin::Named(bins)) => {\n            let unscoped_name = name.rsplit('/').next().unwrap_or(name);\n            let path = if bins.len() == 1 {\n                bins.values().next()\n            } else {\n                bins.get(unscoped_name)\n            };\n            path.with_context(|| {\n                format!(\"npm package {name} declares no executable named {unscoped_name}\")\n            })?\n            .clone()\n        }\n        None => bail!(\"npm package {name} declares no executable\"),\n    };\n\n    Ok(package_directory.join(relative_path))\n}\n\n#[derive(Clone)]\npub struct UnavailableNodeRuntime {\n    error_message: Arc<String>,\n}\n\n#[async_trait::async_trait]\nimpl NodeRuntimeTrait for UnavailableNodeRuntime {\n    fn boxed_clone(&self) -> Box<dyn NodeRuntimeTrait> {\n        Box::new(self.clone())\n    }\n    fn binary_path(&self) -> Result<PathBuf> {\n        bail!(\"{}\", self.error_message)\n    }","sourceCodeStart":1043,"sourceCodeEnd":1079,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/node_runtime/src/node_runtime.rs#L1043-L1079","documentation":"When resolving a package's executable, NodeRuntime reads the npm package's package.json `bin` field. The `Bin` enum distinguishes a single string bin, a named map (`Bin::Named`), and no bin at all (`None`). This message is the None case: the installed package literally declares no executable, so no binary path can be returned.","triggerScenarios":"Calling the package-install/exec path (e.g. installing a language server or tool) for an npm package whose package.json has no `bin` field — typically a pure library package, or the wrong package was requested.","commonSituations":"Asking for the library package instead of the CLI package (e.g. a `-lib`/core package vs the bin-publishing one); a package version that temporarily dropped its bin declaration; typos in package names resolving to a library.","solutions":["Verify the package actually ships a CLI: `npm view <name> bin` — if empty, you want a different package","Request the correct CLI package name for the tool","Pin a version known to declare the bin if a release dropped it"],"exampleFix":"# before: package declares no bin\n$ npm view some-parser bin\n{}\n\n# after: request the package that ships the CLI\n$ npm view some-parser-cli bin\n{ 'some-parser-cli': './bin/cli.js' }","handlingStrategy":"validation","validationCode":"async fn package_has_bin(name: &str, version: &str, http: &Arc<dyn HttpClient>) -> bool {\n    let meta = fetch_package_json(name, version, http).await;\n    meta.get(\"bin\").map_or(false, |b| !b.is_null())\n}","typeGuard":"fn declares_executable(package_json: &serde_json::Value) -> bool {\n    package_json.get(\"bin\").is_some_and(|b| {\n        b.is_string() || b.as_object().is_some_and(|m| !m.is_empty())\n    })\n}","tryCatchPattern":"match resolve_executable_path(&package) {\n    Err(e) if e.to_string().contains(\"declares no executable\") => {\n        // pick the CLI package variant or pin a version that shipped a bin\n        pick_cli_package_alternative(&package).await\n    }\n    r => r?,\n}","preventionTips":["Check `npm view <pkg> bin` before wiring a package as a tool","Name the CLI package, not its library sibling, in configuration","Pin versions whose bin layout you have verified"],"tags":["npm","node-runtime","package","binary","cli"],"backgroundTag":"npm-package-missing-binary","analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}