Troubleshooting Turborepo Frontend Deployment Issues with pnpm

 ERR_PNPM_META_FETCH_FAIL  GET https://registry.npmjs.org/@eslint%2Fjs: Value of "this" must be of type URLSearchParams
 WARN  GET https://registry.npmjs.org/react error (ERR_INVALID_THIS). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/react-dom error (ERR_INVALID_THIS). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/@google-cloud%2Fvision error (ERR_INVALID_THIS). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/@google%2Fgenai error (ERR_INVALID_THIS). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/@huggingface%2Finference error (ERR_INVALID_THIS). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/@types%2Fbcrypt error (ERR_INVALID_THIS). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/@types%2Fcookie-parser error (ERR_INVALID_THIS). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/@types%2Fcors error (ERR_INVALID_THIS). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/@types%2Fexpress error (ERR_INVALID_THIS). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/@types%2Fjsonwebtoken error (ERR_INVALID_THIS). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/@types%2Fmulter error (ERR_INVALID_THIS). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/bcrypt error (ERR_INVALID_THIS). Will retry in 10 seconds. 2 retries left.
 WARN  GET https://registry.npmjs.org/cloudinary error (ERR_INVALID_THIS). Will retry in 10 seconds. 2 retries left.
Error: Command "pnpm install" exited with 1

et others see and understand the problem! →

Facing these issues, I tried looking at other similar posts but I am still not able to figure out what exaclty is the issue, the pnpm version 9.15.9

This looks like a network connectivity issue during the pnpm install process on Vercel’s build servers. The ERR_INVALID_THIS errors suggest there’s a problem with how pnpm is trying to fetch packages from the npm registry.

Here are a few things you can try:

1. Pin your pnpm version in package.json:

{ "packageManager": "pnpm@9.15.9" }

2. Try using a different pnpm version:
Sometimes newer versions can have issues. Try downgrading to a more stable version like pnpm@8.15.6:

{ "packageManager": "pnpm@8.15.6" }

3. Add a .npmrc file to your project root:

registry=https://registry.npmjs.org/ network-timeout=300000 fetch-retries=5 fetch-retry-factor=2

4. Clear any cached dependencies:
Make sure your pnpm-lock.yaml is committed and try redeploying.

5. Check your turborepo configuration:
Ensure your turbo.json and workspace configuration is correct for the frontend app you’re trying to deploy.

If the issue persists, this might be a temporary problem with Vercel’s build environment or the npm registry. You could try redeploying after some time.

Helpful resources: