How to fix pnpm ERR_PNPM_LOCKFILE_CONFIG_MISMATCH error in Astro's Github Action

The current "settings.autoInstallPeers" configuration doesn't match the value found in the lockfile

Published on

I wanted to start a new website with Astro and host it directly on GitHub Pages.

By following this guide on the Astro documentation I integrated the provided Action boilerplate.

I immediately faced this build error:

ERR_PNPM_LOCKFILE_CONFIG_MISMATCH  Cannot proceed with the frozen installation. The current "settings.autoInstallPeers" configuration doesn't match the value found in the lockfile

Update your lockfile using "pnpm install --no-frozen-lockfile"

The solution

After some experimentation with the Action, I discovered that the solution was to add pnpm-version: 8 to the withastro/action@v0 step.

Without declaring the version the Action uses a default version and it may not be the one you have to use.

The full Action file content:

name: Deploy to GitHub Pages

    branches: [main]

  contents: read
  pages: write
  id-token: write

    runs-on: ubuntu-latest
      - name: Checkout your repository using git
        uses: actions/checkout@v3
      - name: Install, build, and upload your site
        uses: withastro/action@v0
          pnpm-version: 8

    needs: build
    runs-on: ubuntu-latest
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v1

Thanks for reading to the end! 🎉

If you’d like to stay in touch Follow me on Twitter and Mastodon.

I'm active in many places on the internet, checkout the footer or the links page.