Skip to content

Support installing pnpm in another folder rather than fixed in GITHUB_WORKSPACE #17

Closed

Description

@lucienshawls

For a mono repo, it is possible that the package.json is in ./docs, but currently, pnpm/setup@v1 could only install pnpm in GITHUB_WORKSPACE, which brings errors.

Could it be possible to install pnpm in the directory where package-json-file is nested?

Activity

  1. ParsaJR commented on Aug 5, 2026

    @ParsaJR

    If the file package.json resides in ./docs directory, then the action template below should install the project just fine.

    jobs:
      build:
        runs-on: ubuntu-latest
        defaults:
          run:
            working-directory: ./docs
    
        strategy:
          matrix:
            node-version: [22]
    
        steps:
          - name: Checkout code
            uses: actions/checkout@v4
    
          - name: setup Node and pnpm
            uses: pnpm/setup@v2
            with:
              runtime: node@${{ matrix.node-version }}
              package-json-file: './docs/package.json'
              install: false
    
          - name: Run pnpm install
            run: pnpm install

    But yes, the package raises an error on pnpm install by its own and doesn't respect the package-json-file path. This is why i have a seperate step pnpm install which runs on a directory that i want.

    Let me know if this workaround solves your issue.

  2. lucienshawls commented on Aug 10, 2026

    @lucienshawls
    Author

    If the file package.json resides in ./docs directory, then the action template below should install the project just fine.

    jobs:
    build:
    runs-on: ubuntu-latest
    defaults:
    run:
    working-directory: ./docs

    strategy:
      matrix:
        node-version: [22]
    
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
    
      - name: setup Node and pnpm
        uses: pnpm/setup@v2
        with:
          runtime: node@${{ matrix.node-version }}
          package-json-file: './docs/package.json'
          install: false
    
      - name: Run pnpm install
        run: pnpm install
    

    But yes, the package raises an error on pnpm install by its own and doesn't respect the package-json-file path. This is why i have a seperate step pnpm install which runs on a directory that i want.

    Let me know if this workaround solves your issue.

    Yes, that works.

    But I was worried if the pnpm store cache could work as intended, since the cache step is in pnpm/setup, but the package installation step is not.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions