thedotmack/claude-mem · error

installPluginDependencies: no package.json at ${targetDir}

Error message

installPluginDependencies: no package.json at ${targetDir}

What it means

Thrown by installPluginDependencies() when the targetDir passed in does not contain a package.json. The function's entire job is to run `bun install` (or the configured install) inside the plugin target, so a missing package.json means the target is not a valid installable project. It is a precondition check before spawning the installer.

Source

Thrown at src/npx-cli/install/setup-runtime.ts:428

  let version = getUvVersion();
  if (!version) {
    await new Promise((r) => setTimeout(r, 1000));
    version = getUvVersion();
  }
  if (!version) {
    installerError(ErrorSeverity.WARN_CONTINUE, {
      component: 'uv-version-probe',
      phase: 'setup-runtime',
      cause: new Error(`uv at ${uvPath} did not respond to --version after retry`),
    }, sum);
    return { uvPath, version: 'unknown' };
  }
  return { uvPath, version };
}

export async function installPluginDependencies(targetDir: string, bunPath: string): Promise<void> {
  if (!existsSync(join(targetDir, 'package.json'))) {
    throw new Error(`installPluginDependencies: no package.json at ${targetDir}`);
  }

  const bunCmd = IS_WINDOWS && bunPath.includes(' ') ? `"${bunPath}"` : bunPath;

  // Per CHANGELOG v12.6.1 -> v12.6.2: tree-sitter-swift's nested
  // tree-sitter-cli postinstall downloads a Rust binary and can hang the
  // install. Bun honors trustedDependencies; npm does not. We additionally
  // pass --ignore-scripts as belt-and-suspenders and bound it with a timeout.
  // Async exec (not execSync): a blocked event loop freezes the installer's
  // clack spinner for the duration of the install, which reads as a stall.
  const runBunInstall = (): Promise<void> =>
    new Promise<void>((resolve, reject) => {
      exec(`${bunCmd} install --frozen-lockfile --ignore-scripts`, {
        cwd: targetDir,
        timeout: INSTALL_TIMEOUT_MS,
        maxBuffer: 16 * 1024 * 1024,
        ...(IS_WINDOWS ? { shell: process.env.ComSpec ?? 'cmd.exe' } : {}),
      }, (error, stdout, stderr) =>

View on GitHub (pinned to d768ba3643)

Solutions

  1. Confirm targetDir is the intended plugin root and that it contains package.json (ls the dir).
  2. Re-run the scaffolding/setup step that is supposed to write package.json into the target before calling installPluginDependencies.
  3. If the path comes from config, update it to the correct plugin directory.
  4. If package.json was deleted, restore it from git or regenerate it, then retry.
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'fs';
if (!existsSync(join(targetDir, 'package.json'))) {
  throw new Error(`Target is not an installable project (no package.json): ${targetDir}`);
}

Type guard

function isInstallableDir(dir: string): boolean {
  return existsSync(join(dir, 'package.json'));
}

Prevention

When it happens

Trigger: Calling installPluginDependencies with a path that is empty, wrong, or points at a directory that was never scaffolded. A plugin target dir whose package.json was deleted or never written by an earlier install step. A path constructed from a stale config value that no longer reflects the filesystem.

Common situations: An interrupted prior install left the target dir half-created. The target dir was supplied from a config/CLI arg that is incorrect. The plugin dir was moved or cleaned up between detection and install. Running install against a path inside a freshly-cloned repo before its own setup wrote package.json.

Related errors


AI-assisted analysis of thedotmack/claude-mem@d768ba3643 (2026-08-12). Data as JSON: /api/errors/54fb9d420c6722a9. Report an issue: GitHub.