Cloudflare page deploy fail with error npm ERR! `store-dir` is not a valid npm option

We are facing an issue deploying a React vite app build using pnpm. Previously it used to work fine but now it fails with the error.
10:05:11.241 Preparing [email protected] for immediate activation…
10:05:13.920 npm ERR! store-dir is not a valid npm option.

We haven’t made any changes to our build configuration, retrying old builds fails as well on Node version 18.14.0

Changing version to 18.13.0 in .nvmrc worked