rohitg00/agentmemory · warning
npm not found on PATH. Install manually: npm install -g @age
Error message
npm not found on PATH. Install manually: npm install -g @agentmemory/agentmemory
What it means
During first-run global-install prompting, agentmemory tries to install the CLI globally via npm (`npm install -g @agentmemory/agentmemory`). Before running it, it checks for an npm executable on PATH with whichBinary; if none is found it warns with the manual install command and skips auto-install. The library does not fail — it delegates installation to the user.
Source
Thrown at src/cli.ts:1218
message:
"Install agentmemory globally so the bare `agentmemory` command works in any shell? [Y/n]",
initialValue: true,
});
if (p.isCancel(answer)) {
// Treat Ctrl+C as "not now" rather than "never". Don't persist.
return;
}
if (answer === false) {
writePrefs({ skipGlobalInstall: true });
p.log.info(
"Skipped. Re-run via `npx @agentmemory/agentmemory` or install later with: npm install -g @agentmemory/agentmemory",
);
return;
}
const npmBin = whichBinary("npm");
if (!npmBin) {
p.log.warn(
"npm not found on PATH. Install manually: npm install -g @agentmemory/agentmemory",
);
return;
}
const ok = runCommand(
npmBin,
["install", "-g", `@agentmemory/agentmemory@${VERSION}`],
{ label: `Installing @agentmemory/agentmemory@${VERSION} globally` },
);
if (ok) {
p.log.success(
"Installed globally. `agentmemory stop` etc. will now work in new shells.",
);
// Persist so we never re-prompt even if the user happens to npx
// again from a CI-less TTY.
writePrefs({ skipGlobalInstall: true });
} else {
p.log.warn(View on GitHub (pinned to e04ba88819)
Solutions
- Install Node.js/npm or fix PATH so `npm` resolves (`which npm` must succeed).
- With nvm: `source ~/.nvm/nvm.sh` or ensure the nvm init line is in your shell rc for non-interactive shells.
- Install the package manually as the message says: `npm install -g @agentmemory/agentmemory`.
- Re-run `agentmemory` setup; it will detect the global install and skip the prompt.
Example fix
// before: npm missing from PATH $ echo $PATH # no nvm/node bin dirs // after $ source ~/.nvm/nvm.sh && which npm && agentmemory start
Defensive patterns
Strategy: validation
Validate before calling
import { execFileSync } from "node:child_process";
function npmOnPath(): boolean {
try { execFileSync(IS_WINDOWS ? "where" : "which", ["npm"], { stdio: "ignore" }); return true; }
catch { return false; }
}
if (!npmOnPath()) console.error("Install Node.js/npm first"); Prevention
- Source nvm/fnm/volta init in non-interactive shells too.
- Use full Node distributions that ship npm (not slim/scratch images).
- After installing Node, reopen shells so PATH updates apply.
- Verify with `which npm` before first-run setup.
When it happens
Trigger: Running the CLI from a system where `which npm` (or `where npm` on Windows) returns nothing — Node installed via a version manager whose bin dir is not on PATH in this shell, or npm removed after a partial Node uninstall.
Common situations: Docker slim images shipping node without npm symlinks; nvm/fnm/volta not initialized in non-interactive shells; using npx in an environment lacking npm; Windows PATH not refreshed after Node install.
Related errors
- curl or sh not found. Install manually: ${iiiConsoleInstal
- ${missing} not found. Cannot auto-install iii-engine.
- Global install failed. Try manually: npm install -g @agentme
- agentmemory: could not locate bundled plugin/ directory (sea
- mem::smart-search: AGENTMEMORY_AGENT_SCOPE=isolated is set b
AI-assisted analysis of rohitg00/agentmemory@e04ba88819 (2026-08-30).
Data as JSON: /api/errors/1aa7f30f68ed6375.
Report an issue: GitHub.