I host my Nuxt project on Vercel. Everything was fine until now.
From now, all builds are throwing this error:
[19:25:54.681] Running "vercel build"
[19:25:55.722] Vercel CLI 33.6.1
[19:25:57.207] Installing dependencies...
[19:25:57.856] error This project's package.json defines "packageManager": "yarn@4.1.1". However the current global version of Yarn is 1.22.22.
[19:25:57.856]
[19:25:57.856] Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from 16.9 and 14.19.
[19:25:57.856] Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack.
[19:25:57.888] Error: Command "yarn install" exited with 1
Local build is fine, but the thing is that have touched any configuration or package.json from the latest successful build.
How can I enable corepack on Vercel? Or what can cause the problem?
When you're using Yarn > v1, you need to enable Corepack, and on Vercel Corepack needs to be enabled with the ENABLE_EXPERIMENTAL_COREPACK
environment variable.
Add the ENABLE_EXPERIMENTAL_COREPACK
variable with value 1
at the Settings > Environment Variables page in your project
Then deploy a new build.
Usually you need to run corepack enable && yarn install
when building, but on Vercel that doesn't work. You'll need to use above environment variable.