I’m currently trying to convert a Next.js project from using npm to pnpm. Locally on my machine everything works as expected. However, trying to deploy to Vercel, fails.
Vercel is supposed to automatically detect the package manager. It correctly detects that I’m using pnpm v9 or v10 due to the lockfile. It chose v9 due to the age of my project. Weird, but Ok. It recommends to set this environment variable to make use of Corepack and the packageManger field from my package.json.
Hey, Could you temporarily enable Source code visibility so we can check? Also just to confirm, you have set ENABLE_EXPERIMENTAL_COREPACK in your project Environment, right?
The setting for Customer Success Code Visibility doesn’t exist for me. I’ve searched all project and team settings. Maybe this doesn’t exist for my Hobby plan?
However, I’ve noticed that there might be an issue with the root directory setting which is causing this error. As you can see in my reproduction and my original repository, the app including pnpm files is in a sub directory called app. I’ve also set the Root Directory setting to that app directory:
It looks like Vercel can find the package.json but was unable to detect a package manager defined in the file. The packageManager must be defined in your package.json in order to use corepack with Vercel, please see here.
But the Root directory is needed since the app incl. it’s package.json is located in the subdirectory called app. There is no package.json in the root of the repository.