If you’re encountering the error pnpm: command not found in your GitHub Actions workflow, it’s likely due to the environment not properly recognizing the pnpm binary. A quick and efficient way to resolve this issue is to create a symbolic link (ln) for pnpm from its installed path to /usr/local/bin/.

In this tutorial, we’ll walk you through fixing the issue by creating a symbolic link to the pnpm binary in your GitHub Actions workflow.

Step 1: Find npm path

which pnpm
/home/developer/.local/share/pnpm/pnpm

Step 2: Create symbolic link for pnpm to /usr/local/bin

sudo ln -s /home/developer/.local/share/pnpm/pnpm /usr/local/bin/pnpm

Step 3: Verify pnpm command in github action workflow

- name: Check environment paths
  run: echo $PATH

- name: Check if npm is installed
  run: which npm

Enjoy!