iOfficeAI/OfficeCLI · error · OfficeCliError

officecli install failed. Run manually: irm ${INSTALL_PS

Error message

officecli install failed. Run manually:
    irm ${INSTALL_PS1_MIRROR} | iex

What it means

Thrown by install() on Windows when the PowerShell-driven install (install.ps1 fetched mirror-first, GitHub fallback) exits non-zero. The SDK deliberately does not auto-install behind your back; this explicit installer failed and points the user at the manual irm | iex command.

Source

Thrown at sdk/node/index.js:624

/**
 * Install the officecli CLI binary via its OFFICIAL installer — explicit by
 * design (this SDK never auto-downloads behind your back). Runs install.ps1 via
 * PowerShell on Windows and install.sh via bash elsewhere. Note: when installed
 * via npm, @officecli/officecli already bundles an auto-updating binary, so this
 * is only needed for a standalone (~/.local/bin or %LOCALAPPDATA%\OfficeCLI)
 * install.
 */
function install() {
  if (IS_WIN) {
    process.stderr.write(`Installing officecli via ${INSTALL_PS1_MIRROR} (github fallback) ...\n`);
    // Fetch the script mirror-first, github fallback, then run it. The whole
    // try/catch is assigned so a mirror failure transparently falls back.
    const ps = `$s = try { irm '${INSTALL_PS1_MIRROR}' } catch { irm '${INSTALL_PS1_GITHUB}' }; $s | iex`;
    const r = spawnSync('powershell', ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command', ps], {
      stdio: 'inherit',
    });
    if (r.status !== 0) {
      throw new OfficeCliError(
        r.status == null ? -1 : r.status,
        `officecli install failed. Run manually:\n    irm ${INSTALL_PS1_MIRROR} | iex`
      );
    }
    return;
  }
  process.stderr.write(`Installing officecli via ${INSTALL_SH_MIRROR} (github fallback) ...\n`);
  // (curl mirror || curl github) | bash — the subshell emits whichever script
  // fetch succeeds; the group keeps the pipe bound to the whole fallback.
  const sh = `(curl -fsSL ${INSTALL_SH_MIRROR} 2>/dev/null || curl -fsSL ${INSTALL_SH_GITHUB}) | bash`;
  const r = spawnSync('bash', ['-c', sh], { stdio: 'inherit' });
  if (r.status !== 0) {
    throw new OfficeCliError(
      r.status == null ? -1 : r.status,
      `officecli install failed. Run manually:\n    curl -fsSL ${INSTALL_SH_MIRROR} | bash`
    );
  }
}

View on GitHub (pinned to 1ced45e900)

Solutions

  1. Run the manual command from an elevated/developer PowerShell: `irm https://d.officecli.ai/install.ps1 | iex`.
  2. If ExecutionPolicy blocks it, run from a session with `Set-ExecutionPolicy -Scope Process Bypass` or invoke with `-ExecutionPolicy Bypass`.
  3. For TLS errors on old PowerShell: `[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12` before irm.
  4. Verify network egress to d.officecli.ai and raw.githubusercontent.com and write access to %LOCALAPPDATA%\OfficeCLI.

Example fix

# before: install() -> officecli install failed. Run manually: irm ... | iex
# after: from a developer PowerShell
Set-ExecutionPolicy -Scope Process Bypass -Force
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
irm https://d.officecli.ai/install.ps1 | iex
Defensive patterns

Strategy: fallback

Try / catch

// Fall back to the documented manual PowerShell command
try { require('@officecli/sdk').install(); }
catch (e) {
  if (/install failed/i.test(e.message)) {
    require('child_process').execSync(
      'powershell -NoProfile -ExecutionPolicy Bypass -Command "irm https://d.officecli.ai/install.ps1 | iex"',
      { stdio: 'inherit' });
  } else throw e;
}

Prevention

When it happens

Trigger: PowerShell execution policy blocks the script; network cannot reach the mirror or GitHub; PowerShell itself is missing/restricted; the install.ps1 script errors partway (e.g. cannot write to %LOCALAPPDATA%\OfficeCLI); TLS settings on old PowerShell block HTTPS.

Common situations: Locked-down corporate Windows with constrained ExecutionPolicy; air-gapped Windows; PowerShell 5.1 default TLS 1.0 failing against TLS-1.2-only endpoints; a user without write permission to the install dir.

Related errors


AI-assisted analysis of iOfficeAI/OfficeCLI@1ced45e900 (2026-08-13). Data as JSON: /api/errors/f1aeac855595abb7. Report an issue: GitHub.