Skip to content

Error: Unable to locate executable file: pnpm #530

Closed

Description

@TechQuery

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

Activity

  1. dmitry-shibanov commented on Jun 28, 2022

    @dmitry-shibanov
    Contributor

    Hello @TechQuery. Thank you for your report. It's an expected behaviour because pnpm should be preinstalled before the setup-node action. Please refer to the documentation for pnpm caching.

    For now I'm going to close the issue.

  2. TechQuery commented on Jun 29, 2022

    @TechQuery
    Author

    @dmitry-shibanov , thanks for your answer, I fixed it with the Advanced Document.

  3. added a commit that references this issue on Oct 16, 2022
  4. landed1 commented on Dec 30, 2024

    @landed1

    Hello @TechQuery. Thank you for your report. It's an expected behaviour because pnpm should be preinstalled before the setup-node action. Please refer to the documentation for pnpm caching.

    For now I'm going to close the issue.

    Thank you, can you explain how to do this please. I am new to this.

  5. TechQuery commented on Dec 30, 2024

    @TechQuery
    Author

    can you explain how to do this please. I am new to this.

    @landed1 Here is an example for new guys: https://github.com/EasyWebApp/WebCell/blob/8d1df6ef74c8d0839fc441044669ec6706cdd88b/.github/workflows/main.yml#L13-L24

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions