When building a project with pnpm, especially when deploying to platforms like Vercel, Cloudflare Pages, or Netlify, you may encounter the following error:
ERR\_PNPM\_OUTDATED\_LOCKFILE Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to date with package.json
This usually means that your pnpm-lock.yaml file is out of sync with the dependencies defined in package.json, and to ensure reproducible builds, the build process is halted.
❓ Why Does This Error Happen?
In CI (Continuous Integration) environments, the --frozen-lockfile option is often enabled by default. This option ensures:
pnpm-lock.yamlmust matchpackage.jsonexactly;- Otherwise, the build will fail to avoid installing potentially inconsistent dependency versions.
This is especially important in collaborative or automated deployment environments to prevent the classic “it works on my machine” problem.
✅ How to Fix It
1. Sync the Lock File Locally
Open your terminal, go to your project directory, and run:
pnpm install
This will automatically update pnpm-lock.yaml to match the current state of package.json.
2. Commit and Push the Changes
Make sure you commit the updated lock file to your Git repository:
git add pnpm-lock.yaml
git commit -m "fix: sync pnpm-lock.yaml with package.json"
git push origin main
3. Redeploy Your Project
After pushing, your deployment platform (like Vercel, Cloudflare Pages, or Netlify) should automatically trigger a new build.
🔧 Optional (Not Recommended): Disable frozen-lockfile
Although you can bypass the error by disabling lockfile validation, this is not recommended as it compromises build consistency.
You could modify the install command like this:
pnpm install --no-frozen-lockfile && pnpm run build
For example, on Cloudflare Pages:
Build command: pnpm install --no-frozen-lockfile && pnpm run build
But again, it’s best to keep pnpm-lock.yaml in sync with package.json.
🧠 Summary
If you encounter the ERR_PNPM_OUTDATED_LOCKFILE error, don’t panic! Just follow these steps:
- Run
pnpm installlocally; - Commit the updated
pnpm-lock.yaml; - Push the changes and redeploy.
Keeping your lock file updated is a crucial part of ensuring stable builds in modern frontend development.
If you’re building a blog or app using frameworks like Astro or Svelte, make it a habit to sync your dependencies and lock file regularly to avoid deployment hiccups.
