thedotmack/claude-mem · error

Post-install check failed: unresolvable modules

Error message

Post-install check failed: unresolvable modules: ${unresolvable.join(', ')}

What it means

verifyCriticalModules is a post-install sanity check that resolves a set of critical module subpaths from the plugin target directory; if any cannot be resolved (unresolvable array non-empty), it throws listing them. This catches 'bun install said OK but the package is broken/incomplete'.

Solutions

  1. Re-run repair/install to redo 'bun install' in the plugin directory cleanly.
  2. Delete node_modules (and lockfile) in the target dir and reinstall from scratch.
  3. Verify the expected package versions/exports exist; check for renamed subpaths after upgrades.
  4. Confirm the target directory is the correct plugin install location.

Example fix

// before
cd ~/.claude/plugin && bun install   # partial install leaves modules unresolvable
// after
rm -rf node_modules bun.lock && bun install   # clean reinstall, then re-run repair
Defensive patterns

Strategy: validation

Validate before calling

import { createRequire } from 'module';
const require = createRequire(path.join(targetDir, 'package.json'));
const unresolved = CRITICAL_SUBPATHS.filter((s) => { try { require.resolve(s); return false; } catch { return true; } });
if (unresolved.length) await reinstall();

Try / catch

try {
  await installPluginDependencies(targetDir);
} catch (e) {
  if (/unresolvable modules/.test(String(e))) {
    console.error('Corrupt install; wipe node_modules and reinstall:', e);
  }
}

Prevention

When it happens

Trigger: installPluginDependencies runs verifyCriticalModules(targetDir) after bun install and one or more expected subpaths fail module resolution in the freshly installed dependency tree.

Common situations: Corrupted or partial bun install (network interruption), wrong/empty targetDir, package exports misconfigured, or a dependency version bump renaming entry points.


AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17). Data as JSON: /api/errors/f61b69bfdf9558b2. Report an issue: GitHub.

Appendix: source

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

  }

  // zod ships its public API behind subpath exports the worker bundle requires.
  // The package dir existing does NOT imply these subpaths resolve (#2730).
  if (dependencies.includes('zod')) {
    for (const subpath of ZOD_REQUIRED_SUBPATHS) {
      try {
        requireFromTarget.resolve(subpath, { paths: resolvePaths });
      } catch {
        // [ANTI-PATTERN IGNORED]: subpath resolve failure is the condition being
        // probed; it is collected in `unresolvable` and surfaced as a loud
        // install failure below.
        unresolvable.push(subpath);
      }
    }
  }

  if (unresolvable.length > 0) {
    throw new Error(
      `Post-install check failed: unresolvable modules: ${unresolvable.join(', ')}`,
    );
  }
}

/** Build an ephemeral summary so callers (e.g. repair) may omit it. */
function summaryOrEphemeral(summary?: InstallSummary): InstallSummary {
  return summary ?? { warnings: [], failedIDEs: [] };
}

export async function ensureBun(summary?: InstallSummary): Promise<{ bunPath: string; version: string }> {
  const sum = summaryOrEphemeral(summary);
  if (!isBunInstalled()) {
    // installBun throws a platform-specific Error on failure; route it through
    // the central decision point so it becomes a loud ABORT (bun is mandatory
    // for hooks — there is no opt-out).
    try {
      installBun();

View on GitHub (pinned to d8bc9755e7)