#github pages pnpm version error

2 messages · Page 1 of 1 (latest)

atomic warrenBOT
#

Hi @echo timber. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

This happens when the Astro GitHub Action can’t detect which package manager/version to use. The action auto-detects from your lockfile; you must commit your lockfile (e.g., pnpm-lock.yaml). If detection still fails, explicitly set the package manager in the workflow.

  • Ensure pnpm lockfile is committed (required for auto-detect) (see the caution about committing a lockfile) (Deploy to GitHub Pages).
  • Or, set package-manager in your workflow:
# .github/workflows/deploy.yml
name: Deploy to GitHub Pages
on:
  push:
    branches: [ main ]
  workflow_dispatch:

permissions:
  contents: read
  pages: write
  id-token: write

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: withastro/action@v3
        with:
          package-manager: pnpm@latest  # explicitly specify pnpm
  deploy:
    needs: build
    runs-on: ubuntu-latest
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - id: deployment
        uses: actions/deploy-pages@v4

The Astro docs note the action supports specifying package-manager and that a lockfile should be committed for auto-detection (and show where to add these options) (Deploy to GitHub Pages).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: