npmnext.jsvercelpnpm

Next.js How to fix ERR_PNPM_OUTDATED_LOCKFILE?


When I deploy my project to Vercel, the build fails with this error:

ERR_PNPM_OUTDATED_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up-to-date with package.json

What does this mean and how do I fix it?


Solution

  • TL;DR just run pnpm install so it can update the lockfile.

    This issue is caused by the PNPM package manager that Vercel uses if it's out of sync with NPM.

    It happens when you are using both NPM and PNPM on your Next.js project.

    Learn more about PNPM here: https://pnpm.io/

    To fix this issue, sync npm and pnpm by running pnpm install and pushing the updated pnpm-lock.yaml file. You can also choose to remove your package-lock.json file if you want to completely switch to pnpm (it works mostly the same as npm with a few benefits (mainly no large node_modules folder)