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

  1. Re-run and accept the prompt — the default is yes, so pressing Enter is enough
  2. For scripts and CI, pass --yes so no prompt appears: `deno x --yes <pkg>`
  3. 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

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


AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16). Data as JSON: /api/errors/a5c7c5764b2212e9. Report an issue: GitHub.