Error: Unable to locate executable file: pnpm

Description

I was migrating my Yarn Project to PNPM, but my GitHub actions crashed with actions/setup-node.

Action version

v2 & v3

Platform

  • Ubuntu
  • macOS
  • Windows

Runner type

  • Hosted
  • Self-hosted

Tools version

PNPM 7.3.0

Repro steps

My migration of Workflow YAML shown below:

name: CI & CD
on:
    push:
        branches:
            - master
jobs:
    Build-and-Deploy:
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v3
            - uses: actions/setup-node@v3
              with:
                  node-version: 14
-                 cache: yarn
+                 cache: pnpm
            - name: Install & Build
-             run: yarn  &&  yarn build
+             run: pnpm i  &&  pnpm build

Expected behavior

Actions run successfully as Yarn cached version

Actual behavior

Error thrown:

Found in cache @ /opt/hostedtoolcache/node/14.19.3/x64
Error: Unable to locate executable file: pnpm. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.

If I disable PNPM cache and install PNPM manually, it works for now:

name: CI & CD
on:
    push:
        branches:
            - master
jobs:
    Build-and-Deploy:
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v3
            - uses: actions/setup-node@v3
              with:
                  node-version: 14
-                 cache: pnpm
+           - name: Install PNPM
+             run: npm i -g pnpm
            - name: Install & Build
              run: pnpm i  &&  pnpm build