How to fix "Cannot install with 'frozen-lockfile' because pnpm-lock.yaml is absent" in pnpm
Resolving pnpm's frozen-lockfile error in CI/CD pipelines
I've been setting up a new project CI/CD pipeline with pnpm and GitHub Actions and encountered a weird issue. It was throwing an error:
Cannot install with "frozen-lockfile" because pnpm-lock.yaml is absent
This didn't make much sense to me because the pnpm-lock.yaml
file was present in the repository. I tried running a clean pnpm install, but it didn't help. Then I discovered that a few lines above in the logs, there was a warning:
WARN Ignoring not compatible lockfile at pnpm-lock.yaml
This pushed me in the right direction. I found out that my CI was running an old version of pnpm, or simply a much different version than the one on my local machine.
To fix the issue, I first replaced pnpm/action-setup@v2
with the newer version pnpm/action-setup@v4
and set the version of pnpm to the one I have locally.
Published on August 2, 2024 • 1 min read