npm-debug
Skill9 starsChanged 8 days agoMITView on GitHub
Diagnose npm/Node toolchain failures: install, peer-dependency, lockfile, cache, and script runtime issues. Load ONLY when an npm/Node toolchain failure is observed in a local dev folder. Provides a bounded, non-destructive triage playbook; never auto-runs `rm -rf node_modules` or cache wipes without explicit confirmation.
- Deletes or force-pushes
- Installs packages
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- build-debugSkill
- comprehension-workflowSkill
- dev-cleanupSkill
- angular-patternsSkill
- dotnet-conventionsSkill
- python-conventionsSkill
- github-actions-cicdSkill
- structural-searchSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
SHOULD be loaded only after the orchestrator has classified the failure as npm/Node-related (see agents/orchestrator.md "Routing …
- Distinctive: line 34
Capture the exact failing command and its full stderr: Do not paraphrase; quote it verbatim in the report.
- Very specific: line 42
Reproduce minimally: run the same command with --no-audit --no-fund first to remove noise.
- Very specific: line 60
Do NOT silence with npm install --legacy-peer-deps blindly — surface the conflict in the report and let the user decide.
- Distinctive: line 94
When any of these is genuinely needed, present the exact command, the files/paths affected, and a one-line rationale in the root session, …
- Very specific: line 99
After triage, the npm-helper report SHOULD include:
- Very specific: line 108
Keep the report compact; do not paste full npm-debug.log contents unless the failing line is itself the evidence.
- Very specific: line 113
Check for: stale lockfiles checked in alongside modified package.json, missing engines.node / .nvmrc, npm-shrinkwrap.json vs …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
npm / Node Toolchain Debugging
A bounded playbook for diagnosing npm/Node toolchain failures. This skill is opt-in for npm-helper and
SHOULD be loaded only after the orchestrator has classified the failure as npm/Node-related (see
agents/orchestrator.md "Routing Disambiguation: deploy-helper vs build-helper vs npm-helper vs pc-doctor").
Scope
In scope:
npm install,npm ci,npm update, andnpxfailures.package.json/package-lock.jsonpeer-dependency and version-resolution conflicts.- Node version mismatches (
engines,.nvmrc,nvm, Volta, Corepack). - npm cache integrity errors and registry connectivity issues.
- Script-time runtime errors caused by missing binaries (
node_modules/.bin) or wrongPATH.
Out of scope — delegate to another helper:
- TypeScript / Vite / webpack build errors →
build-helper(skills/build-debug). - CI/CD or deploy-platform failures →
deploy-helper(skills/github-actions-cicd). - Windows-local PATH, registry, or service issues →
pc-doctor.
Triage Order (Read Before Acting)
- Capture the exact failing command and its full stderr. Do not paraphrase; quote it verbatim in the report.
- Note the working directory.
npmresolves relative to the current shell, not the repo root, so "ran in the wrong folder" is a common false lead. - Confirm Node + npm versions:
node -v,npm -v, and compare toengines.nodeinpackage.jsonand to.nvmrcif present. A version mismatch usually explains peer-dep errors and engine warnings. - Inspect lockfile state:
git status package.json package-lock.json. Ifpackage-lock.jsonis modified locally or missing, prefernpm ciovernpm installto reproduce CI exactly. - Reproduce minimally: run the same command with
--no-audit --no-fundfirst to remove noise. Only escalate to--verboseor--loglevel sillyonce the simple repro fails the same way.
Common Failures and First-Line Fixes
EACCES / permission errors on global installs
- Cause: previous
sudo npm install -gleft root-owned files behind, or a corporate policy denies global installs. - First-line fix: switch to a Node version manager (
nvm, Volta, Corepack) and install per-user. Do NOT recommendchown -Ron/usror similar system-wide permission changes.
EPEERINVALID / peer-dependency conflicts
- Cause: a top-level dep requested a peer that another top-level dep does not satisfy.
- First-line fix: run
npm ls <package>to see the resolved tree, then check whether the project pins a transitive viaoverrides/resolutions. If the conflict is purely advisory (npm 7+ reports but does not enforce), document it as a warning rather than blocking. - Do NOT silence with
npm install --legacy-peer-depsblindly — surface the conflict in the report and let the user decide.
ELIFECYCLE / errno 137 during scripts
- Cause: usually OOM-killed on a memory-constrained runner, or a script exited non-zero and left the process tree dirty.
- First-line fix: re-run with
NODE_OPTIONS=--max-old-space-size=4096(raise cautiously) and inspectnpm-debug.logfor the underlying script error before assuming memory.
EINTEGRITY / cache corruption
- Cause: corrupted tarballs in the npm cache (
~/.npm/_cacache). - First-line fix:
npm cache verify. Ifverifyreports corruption, the next step (npm cache clean --force) is destructive and MUST require explicit user confirmation — see "Destructive Steps" below.
ENOTFOUND / ETIMEDOUT to the registry
- Cause: network or proxy misconfiguration, not a project bug.
- First-line fix: confirm
npm config get registry, then checkHTTPS_PROXY/HTTP_PROXYenv vars and the project's.npmrc. Do NOT recommend swapping registries without user approval.
Destructive Steps (Require Explicit Confirmation)
The following commands can lose work, time, or local dev state. The orchestrator MUST pause and request
explicit user confirmation before any of them are run, even when delegated to npm-helper:
npm cache clean --force— drops the entire npm cache.rm -rf node_modules— destroys the local install; recoverable via reinstall but slow.rm package-lock.json(followed bynpm install) — generates a new lockfile that may diverge from CI/team state.nvm uninstall <version>/volta uninstall <version>— removes a Node toolchain version.- Any global install with
sudoor to a system path.
When any of these is genuinely needed, present the exact command, the files/paths affected, and a one-line rationale in the root session, and wait for an explicit "yes" before executing.
Reporting Format
After triage, the npm-helper report SHOULD include:
- Failing command (verbatim) and working directory.
- Node and npm versions (
node -v,npm -v). - The first actionable root cause identified, with the file:line or config key that supports it.
- The minimum fix (exact command or
package.jsonchange) and whether it is destructive. - A short "what I did NOT do and why" line for any candidate fix that was ruled out, so the user can revisit it later.
Keep the report compact; do not paste full npm-debug.log contents unless the failing line is itself
the evidence.
When Reviewing or Debugging
Check for: stale lockfiles checked in alongside modified package.json, missing engines.node /
.nvmrc, npm-shrinkwrap.json vs package-lock.json drift, and preinstall / postinstall scripts
that hide side effects behind npm install. These are higher priority than version-pinning nits.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

