I am currently trying to deploy my project to Vercel but I keep running into this error
src/app/layout.tsx
12:48:04.571 : An error occurred in next/font.
12:48:04.572 : Error: Cannot find module ‘../lightningcss.linux-x64-gnu.node’
[11:57:16.016] Require stack:
[11:57:16.016] - /vercel/path0/node_modules/lightningcss/node/index.js
[11:57:16.016] - /vercel/path0/node_modules/@tailwindcss/node/dist/index.js
[11:57:16.016] - /vercel/path0/node_modules/@tailwindcss/postcss/dist/index.js
[11:57:16.016] - /vercel/path0/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js
[11:57:16.016] - /vercel/path0/node_modules/next/dist/build/webpack/config/blocks/css/index.js
[11:57:16.017] - /vercel/path0/node_modules/next/dist/build/webpack/config/index.js
[11:57:16.017] - /vercel/path0/node_modules/next/dist/build/webpack-config.js
[11:57:16.017] - /vercel/path0/node_modules/next/dist/build/webpack/plugins/next-trace-entrypoints-plugin.js
[11:57:16.017] - /vercel/path0/node_modules/next/dist/build/collect-build-traces.js
[11:57:16.017] - /vercel/path0/node_modules/next/dist/build/index.js
[11:57:16.017] - /vercel/path0/node_modules/next/dist/cli/next-build.js
[11:57:16.017] at Function. (node:internal/modules/cjs/loader:1401:15)
[11:57:16.017] at /vercel/path0/node_modules/next/dist/server/require-hook.js:55:36
[11:57:16.017] at defaultResolveImpl (node:internal/modules/cjs/loader:1057:19)
[11:57:16.017] at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1062:22)
[11:57:16.017] at Function._load (node:internal/modules/cjs/loader:1211:37)
[11:57:16.017] at TracingChannel.traceSync (node:diagnostics_channel:322:14)
[11:57:16.017] at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
[11:57:16.017] at Module. (node:internal/modules/cjs/loader:1487:12)
[11:57:16.017] at mod.require (/vercel/path0/node_modules/next/dist/server/require-hook.js:65:28)
[11:57:16.017] at require (node:internal/modules/helpers:135:16)
For context, the issue began when I started using next-intl where I had to rearrange my folder structure to use the src folder.
Most solutions online recommend that I delete my package-lock.json file and reinstall the packages but it hasn’t worked for me yet. I’ve also read the next/js documentation and they recommend running their built-in-next-font codemod but it hasn’t helped either. I have even opted to downgrade my next version to 14.2.28 to see if it would help but the issue is still unresolved.
I had earlier on thought that the error was because of my Node.js version so I upgraded it to 24.0.2 to run with Next 15.3.0 but the error persisted. It still running on that.
I wasn’t able to replicate the error with my test app. Do you have a minimal reproducible example that I can use to dig into this? That way we can debug it together from the same code
I was able to “fix” the error by remaking the project but this time I started with localization, using next-intl folder structure. So I have a hunch that rearranging my folder structure caused the problem. Could this be?