stablyai/orca · critical

Packaged node-pty is missing ${conptyRoot}

Error message

Packaged node-pty is missing ${conptyRoot}

What it means

Thrown by findNodePtyConptySourceDir when packaging node-pty for a Windows build: the directory node_modules/node-pty/third_party/conpty does not exist. The packager needs that vendor tree to source conpty.dll and OpenConsole.exe at runtime, because node-pty's Windows addon loads conpty.dll relative to conpty.node and its install script can run before electron-builder gathers resources. Only reached when build/Release/conpty.node exists and at least one runtime file (conpty.dll or OpenConsole.exe) is missing from build/Release/conpty.

Source

Thrown at config/packaged-runtime-node-modules.cjs:300

  const targetPrefix = `${platformPrefix}${architecture}`
  const platformPrefixes = Object.values(NODE_PTY_PREBUILD_PREFIX_BY_PLATFORM)
  for (const entry of readdirSync(directory, { withFileTypes: true })) {
    if (!entry.isDirectory() || !platformPrefixes.some((prefix) => entry.name.startsWith(prefix))) {
      continue
    }
    const matchesTarget =
      entry.name.startsWith(platformPrefix) &&
      (entry.name === targetPrefix || (allowsSuffix && entry.name.startsWith(`${targetPrefix}-`)))
    if (!matchesTarget) {
      rmSync(join(directory, entry.name), { recursive: true, force: true })
    }
  }
}

function findNodePtyConptySourceDir(nodePtyDir, windowsArch) {
  const conptyRoot = join(nodePtyDir, 'third_party', 'conpty')
  if (!existsSync(conptyRoot)) {
    throw new Error(`Packaged node-pty is missing ${conptyRoot}`)
  }
  for (const entry of readdirSync(conptyRoot, { withFileTypes: true })) {
    if (!entry.isDirectory()) {
      continue
    }
    const sourceDir = join(conptyRoot, entry.name, `win10-${windowsArch}`)
    if (existsSync(sourceDir)) {
      return sourceDir
    }
  }
  throw new Error(`Packaged node-pty has no ConPTY payload for win10-${windowsArch}`)
}

function ensurePackagedNodePtyConptyRuntime(nodePtyDir, electronArch) {
  const releaseDir = join(nodePtyDir, 'build', 'Release')
  if (!existsSync(join(releaseDir, 'conpty.node'))) {
    return
  }

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Run pnpm rebuild node-pty (or npm rebuild node-pty) so the install script restores third_party/conpty.
  2. Verify the install was not run with flags that skip optional dependencies (remove --omit=optional / --prod from the install line for the packaging step).
  3. Confirm node-pty is still version 1.1.0 (the version this packager is wired for) via node_modules/node-pty/package.json.
  4. If node-pty upstream changed its vendor layout, update findNodePtyConptySourceDir in config/packaged-runtime-node-modules.cjs to match the new path.

Example fix

// before (install skipped optional vendor assets)
// pnpm install --prod

// after
// pnpm install
// pnpm rebuild node-pty
// then confirm the dir exists:
//   ls node_modules/node-pty/third_party/conpty/*/win10-x64
Defensive patterns

Strategy: validation

Validate before calling

const { existsSync } = require('node:fs')
const { join } = require('node:path')

function assertNodePtyConptyVendorPresent(nodePtyDir) {
  const conptyRoot = join(nodePtyDir, 'third_party', 'conpty')
  if (!existsSync(conptyRoot)) {
    throw new Error(`Refusing to package: ${conptyRoot} missing. Run 'pnpm rebuild node-pty' first.`)
  }
}
// call before prunePackagedNodePty:
// assertNodePtyConptyVendorPresent(join(resourcesDir, 'node_modules', 'node-pty'))

Try / catch

try {
  ensurePackagedNodePtyConptyRuntime(nodePtyDir, electronArch)
} catch (error) {
  if (/Packaged node-pty is missing/.test(error.message)) {
    console.error(`${error.message}\nRun 'pnpm rebuild node-pty' then retry the package step.`)
    process.exit(1)
  }
  throw error
}

Prevention

When it happens

Trigger: Called during prunePackagedNodePty (electronPlatformName === 'win32') when ensurePackagedNodePtyConptyRuntime finds missing NODE_PTY_CONPTY_RUNTIME_FILES. The third_party/conpty directory was either never installed, pruned by an earlier step, or removed by an npm/pnpm reinstall that stripped optional vendor assets.

Common situations: Reinstalling node-pty with --omit=optional or a pnpm hoist setting that drops third_party; running a Windows packager step on a stale node_modules; CI caching that excluded the conpty vendor tree; upgrading node-pty to a version that renamed or removed the third_party layout.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/8b50d450f0546e0e. Report an issue: GitHub.