Skip to content

fix: hooks degrade gracefully when node is not on PATH - #57

Merged
DietrichGebert merged 1 commit into
mainfrom
fix/node-on-path
Jun 15, 2026
Merged

DietrichGebert merged 1 commit into
mainfrom
fix/node-on-path

Conversation

@DietrichGebert

Copy link
Copy Markdown
Owner

Fixes #51.

Claude Code runs hooks through a non-interactive /bin/sh. On setups where node isn't on that shell's PATH (Nix/nix-darwin, nvm, fnm), the SessionStart and UserPromptSubmit hooks failed with /bin/sh: node: command not found, on every prompt.

  • Guard each hook command: command -v node >/dev/null 2>&1 && node "..." || exit 0 (and a Get-Command node guard for the PowerShell commandWindows). Node-absent now exits 0 silently instead of erroring every prompt.
  • The slash-command skills are unaffected (Claude Code discovers skills/ directly); only the always-on activation + mode tracking need node.
  • Document the node requirement in the README install section, with a Nix/nvm note.

Verified: hooks.json parses, the guard runs node when present and exits 0 silently when absent, full suite 33/33, rule check green. @githappens offered to test on a node-less PATH.

🤖 Generated with Claude Code

Claude Code runs hooks via a non-interactive /bin/sh. On setups where node
isn't on that shell's PATH (Nix/nix-darwin, nvm, fnm), every prompt errored
with "/bin/sh: node: command not found". Guard each hook command so it runs
node only when present and exits 0 otherwise, no more per-prompt noise. The
slash-command skills are unaffected; only the always-on activation needs node.
Document the requirement in the README install section.

Closes #51.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@DietrichGebert
DietrichGebert merged commit d676635 into main Jun 15, 2026
1 check passed
@DietrichGebert
DietrichGebert deleted the fix/node-on-path branch June 15, 2026 09:24
@githappens

Copy link
Copy Markdown

Confirmed fixed on my end — pulled main HEAD (b41cb8d) via a clean marketplace remove/re-add/reinstall, and the guarded hooks now exit 0 silently instead of erroring on every prompt. No more /bin/sh: node: command not found on my Nix/nix-darwin setup (node scoped to a dev shell, intentionally off the global PATH). Fast turnaround — thanks!

DevZonayed pushed a commit to DevZonayed/ponytail that referenced this pull request Aug 17, 2026
…t#57)

Claude Code runs hooks via a non-interactive /bin/sh. On setups where node
isn't on that shell's PATH (Nix/nix-darwin, nvm, fnm), every prompt errored
with "/bin/sh: node: command not found". Guard each hook command so it runs
node only when present and exits 0 otherwise, no more per-prompt noise. The
slash-command skills are unaffected; only the always-on activation needs node.
Document the requirement in the README install section.

Closes DietrichGebert#51.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Afristrat pushed a commit to Afristrat/ponytail that referenced this pull request Sep 29, 2026
…t#57)

Claude Code runs hooks via a non-interactive /bin/sh. On setups where node
isn't on that shell's PATH (Nix/nix-darwin, nvm, fnm), every prompt errored
with "/bin/sh: node: command not found". Guard each hook command so it runs
node only when present and exits 0 otherwise, no more per-prompt noise. The
slash-command skills are unaffected; only the always-on activation needs node.
Document the requirement in the README install section.

Closes DietrichGebert#51.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UserPromptSubmit hook errors on every prompt when node isn't on a global PATH (undeclared dependency)

2 participants