Skip to content

fix: invoke pnpm by absolute path in Makefile, fix target path#48

Merged
bushidocodes merged 1 commit into
masterfrom
fix/pnpm-makefile-path
Jun 16, 2026
Merged

fix: invoke pnpm by absolute path in Makefile, fix target path#48
bushidocodes merged 1 commit into
masterfrom
fix/pnpm-makefile-path

Conversation

@bushidocodes

Copy link
Copy Markdown
Owner

Problem

The pnpm installer only adds $PNPM_HOME/bin to PATH via ~/.bashrc, which a non-interactive make recipe never sources. So every pnpm-dependent target (node, http-server, netlify, fkill, bats) failed calling bare pnpm:

make: pnpm: No such file or directory
make: *** [Makefile:40: ~/.local/share/pnpm/node] Error 127

Two underlying issues:

  1. pnpm not on PATH in the recipe (the failure above).
  2. Wrong target path — modern pnpm (v11) installs to ~/.local/share/pnpm/bin/pnpm, not ~/.local/share/pnpm/pnpm, so the target file was never created and make re-ran the installer on every invocation.

Fix

PNPM_HOME := $(HOME)/.local/share/pnpm
PNPM := PNPM_HOME=$(PNPM_HOME) PATH="$(PNPM_HOME)/bin:$$PATH" $(PNPM_HOME)/bin/pnpm

$(PNPM_HOME)/bin/pnpm:
	curl -fsSL https://get.pnpm.io/install.sh | sh -

~/.local/share/pnpm/node: $(PNPM_HOME)/bin/pnpm
	$(PNPM) env use --global lts
# ...http-server, netlify, fkill, bats likewise

Invokes the absolute pnpm binary with PNPM_HOME set and its global bin dir on PATH (pnpm refuses i -g if the global bin dir isn't on PATH).

Verification

Run in a fresh ubuntu:24.04 container against the new Makefile — previously-failing targets now succeed:

+ node 24.16.0   (pnpm env use --global lts)   EXIT=0
+ bats 1.13.0    (pnpm i -g bats)              EXIT=0

Found via the same container test that validated #39/#40/#41/#42.

Fixes #47

🤖 Generated with Claude Code

The pnpm install only adds $PNPM_HOME/bin to PATH via ~/.bashrc, which
non-interactive make recipes never source, so every dependent target
(node, http-server, netlify, fkill, bats) died on a bare `pnpm`:

    make: pnpm: No such file or directory  ->  Error 127

Also, modern pnpm (v11) installs to ~/.local/share/pnpm/bin/pnpm, not
~/.local/share/pnpm/pnpm, so the old target file was never created and
make re-ran the installer every time.

Define PNPM_HOME and invoke the absolute pnpm binary with PNPM_HOME set
and its global bin dir on PATH (pnpm refuses `i -g` otherwise). Point
the prerequisite at the real binary path.

Verified in a fresh ubuntu:24.04 container: node 24.16.0 and bats 1.13.0
now install cleanly (exit 0).

Fixes #47

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

pnpm Makefile targets fail: pnpm not on PATH in recipe, wrong binary path

1 participant