After committing pnpm patch my build is failing
log:
Initializing build environment...
Success: Finished initializing build environment
Cloning repository...
Restoring from dependencies cache
Restoring from build output cache
Detected the following tools from environment: pnpm@10.11.1, nodejs@22.16.0
Installing project dependencies: pnpm install --frozen-lockfile
ERR_PNPM_LOCKFILE_CONFIG_MISMATCH Cannot proceed with the frozen installation. The current "patchedDependencies" configuration doesn't match the value found in the lockfile
Update your lockfile using "pnpm install --no-frozen-lockfile"
Failed: error occurred while installing tools or dependencies
-------
I've tried running pnpm install --no-frozen-lockfile and then committing new pnpm-lock.yaml still same problem. I've then deleted the old lockfile and run pnpm install to generate new lockfile but still same error.
when i created the patch with pnpm patch-commit <tmp-package-path>, it generated the pnpm-workspace.yaml with this content:
patchedDependencies:
@hono/firebase-auth@1.4.2: patches/@honofirebase-auth@1.4.2.patch
and pnpm-lock.yaml contains:
lockfileVersion: '9.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
patchedDependencies:
'@hono/firebase-auth@1.4.2':
hash: 61ea9f9945ac2193ce416f638784e341305fbfd53dd4f5a592823af23fe875d5
path: patches/@honofirebase-auth@1.4.2.patch
importers:
.:
dependencies:
'@hono/firebase-auth':
specifier: ^1.4.2
version: 1.4.2(patch_hash=61ea9f9945ac2193ce416f638784e341305fbfd53dd4f5a592823af23fe875d5)(hono@4.9.9)
first time i got this error in deployment log: ERROR packages field missing or empty. so i added:
packages:
- .
3 Replies
after that i keep getting the same error.
after watching few videos on pnpm patch, i've found that we don't need pnpm-workspace.yaml, we can specify patchedDependencies directly inside package.json so i deleted the workspace and tried this new method and generated the new lockfile but still same error. i think it's due to the way cloudflare CI/CD saves pnpm packages but i don't have any source to confirm this, something i related found but for netlify https://answers.netlify.com/t/using-pnpm-and-pnpm-workspaces/2759
Netlify Support Forums
Using pnpm and pnpm workspaces
Just as an informative note for future users, here some info on how to workaround Netlify’s CI in order to use pnpm instead of npm or yarn and pnpm workspaces. Remove your package-lock.json or yarn.lock file and add it to your .gitignore, if applicable. Be sure to track pnpm-lock.yaml instead. If you’re using workspaces: add pnpm itsel...
ERR_PNPM_LOCKFILE_CONFIG_MISMATCH Cannot proceed with the frozen installation. The current "patchedDependencies" configuration doesn't match the value found in the lockfileapparently your lockfile is out of date
I've updated the lockfile multiple time but problem persist
git committing after removing pnpm-lock.yaml does get build successfully on cloudflare, but my patch never get applies!