denoland/deno · error · anyhow::Error
Installation rejected
Error message
Installation rejected
What it means
The first time `deno x <pkg>` runs, it creates a temp install project and prompts "Install <pkg>?" (default yes, x.rs:892-908). Only an explicit decline — or a prompt that ends with no answer while the drawing thread is supported (e.g. immediate EOF) — aborts with "Installation rejected". Note the asymmetry at x.rs:900-906: when the terminal cannot draw prompts at all, Deno warns and installs anyway.
Solutions
- Re-run `deno x <pkg>` and confirm with Enter (yes is the default).
- Skip the prompt entirely: `deno x -y <pkg>`.
- For unattended use, pre-install once with `deno install -g <pkg>` so x never needs to prompt again.
Example fix
# before $ deno x some-tool </dev/null ? Install some-tool? … error: Installation rejected # after deno x -y some-tool
Defensive patterns
Strategy: retry
Validate before calling
# Pre-install so deno x never needs the confirmation prompt deno install -g <pkg> >/dev/null 2>&1 deno x <pkg>
Prevention
- Pass -y/--yes to deno x in every script and CI job.
- Pre-install packages with deno install -g for unattended environments.
- Keep stdin usable (or closed with -y) when wrapping deno x in harnesses that capture input.
When it happens
Trigger: Answering `n` to the install confirmation; piping/redirecting stdin so the prompt reads EOF; scripts calling deno x without -y in an environment that can render prompts but receives no input.
Common situations: Interactive sessions where the user changes their mind; CI jobs with a TTY emulator and closed stdin; wrappers that capture stdin for logging.
Related errors
- Unable to choose binary for
- Use 'deno run' to run a local file directly, 'deno x' is…
- An executable name was not provided. One could not be…
- app name resolves its to , which is already part of the…
- BenchContext::end() has already been invoked
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/a5c7c5764b2212e9.
Report an issue: GitHub.
Appendix: source
Thrown at cli/tools/x.rs:910
XTempDir::New(temp_dir) => {
let confirmed = yes
|| match confirm(ConfirmOptions {
default: true,
message: format!("Install {}?", req_ref),
}) {
Some(true) => true,
Some(false) => false,
None if !DrawThread::is_supported() => {
log::warn!(
"Unable to prompt, installing {} without confirmation",
req_ref.req()
);
true
}
None => false,
};
if !confirmed {
return Err(anyhow::anyhow!("Installation rejected"));
}
match req_ref {
ReqRef::Npm(req_ref) => {
let pkg_json = temp_dir.join("package.json");
std::fs::write(
&pkg_json,
format!(
"{{\"dependencies\": {{\"{}\": \"{}\"}} }}",
req_ref.req().name,
req_ref.req().version_req
),
)?;
}
ReqRef::Jsr(req_ref) => {
let deno_json = temp_dir.join("deno.json");
let mut imports = serde_json::Map::new();
imports.insert(
req_ref.req().name.to_string(),View on GitHub (pinned to 9ad36f7a2c)