I’m getting this error when building my nextjs project. However, when building locally, or inside a docker it works fine.
app/layout.tsx
An error occurred in `next/font`.
Error: Cannot find module '../lightningcss.linux-x64-gnu.node'
Require stack:
- /vercel/path0/node_modules/lightningcss/node/index.js
- /vercel/path0/node_modules/@tailwindcss/postcss/dist/index.js
- /vercel/path0/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js
- /vercel/path0/node_modules/next/dist/build/webpack/config/blocks/css/index.js
- /vercel/path0/node_modules/next/dist/build/webpack/config/index.js
- /vercel/path0/node_modules/next/dist/build/webpack-config.js
- /vercel/path0/node_modules/next/dist/build/webpack-build/impl.js
- /vercel/path0/node_modules/next/dist/compiled/jest-worker/processChild.js
at Function.<anonymous> (node:internal/modules/cjs/loader:1225:15)
at /vercel/path0/node_modules/next/dist/server/require-hook.js:55:36
at Function._load (node:internal/modules/cjs/loader:1055:27)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:220:24)
at Module.<anonymous> (node:internal/modules/cjs/loader:1311:12)
at mod.require (/vercel/path0/node_modules/next/dist/server/require-hook.js:65:28)
at require (node:internal/modules/helpers:136:16)
at Object.<anonymous> (/vercel/path0/node_modules/lightningcss/node/index.js:21:22)
It happens when deploying to Vercel. Any tips on what could be causing this?