denoland/deno · error · anyhow::Error
Installation rejected
Error message
Installation rejected
What it means
Before `deno x` materializes a package into its temp dir it asks `Install <req>?`. Declining the prompt (or an aborted prompt on a terminal where the draw thread is supported) returns 'Installation rejected'. A truthy `--yes` flag skips the question; unsupported terminals auto-proceed with a warning.
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 89f33cbef2)
Solutions
- Re-run and accept the prompt — the default is yes, so pressing Enter is enough
- For scripts and CI, pass --yes so no prompt appears: `deno x --yes <pkg>`
- If the prompt is surprising, inspect the package requirement first, then confirm deliberately
Example fix
# before deno x some-pkg # then answer 'n' at the prompt # after deno x --yes some-pkg
Defensive patterns
Strategy: validation
Validate before calling
# scripts and CI: skip the interactive prompt entirely deno x --yes some-pkg --flag arg
Prevention
- Pass --yes in non-interactive or scripted environments
- Feed Enter (the default answer is yes) when prompted interactively
- Pin the package requirement so the confirmation names exactly what you audited
When it happens
Trigger: Answering 'n' at the `Install <package>?` confirmation during `deno x`, or interrupting the prompt so it yields no answer on a supported terminal.
Common situations: Interactive use where the user changes their mind; scripted runs inside a capable terminal that receive EOF instead of a confirmation.
Related errors
- Use 'deno run' to run a local file directly, 'deno x' is int
- Unable to choose binary for {} Available bins: {}
- The bench name can't be empty
- invalid doc test hashbang: #!/bin/sh (binary basename needs
- invalid doc test hashbang: #!/usr/bin/env -S deno run --allo
AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16).
Data as JSON: /api/errors/a5c7c5764b2212e9.
Report an issue: GitHub.