Reproduction: GitHub - Hawxy/nextjs-render-reproduction
This is a completely stock next.js app with tailwind. Builds fine locally across multiple developer machines. Fails in render’s pipeline with:
Oct 27 12:29:19 AM Failed to compile.
Oct 27 12:29:19 AM
Oct 27 12:29:19 AM src/app/layout.tsx
Oct 27 12:29:19 AM An error occured in `next/font`.
Oct 27 12:29:19 AM
Oct 27 12:29:19 AM Error: Cannot find module 'autoprefixer'
Oct 27 12:29:19 AM Require stack:
Oct 27 12:29:19 AM - /opt/render/project/src/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js
Oct 27 12:29:19 AM - /opt/render/project/src/node_modules/next/dist/build/webpack/config/blocks/css/index.js
Oct 27 12:29:19 AM - /opt/render/project/src/node_modules/next/dist/build/webpack/config/index.js
Oct 27 12:29:19 AM - /opt/render/project/src/node_modules/next/dist/build/webpack-config.js
Oct 27 12:29:19 AM - /opt/render/project/src/node_modules/next/dist/build/webpack/plugins/next-trace-entrypoints-plugin.js
Oct 27 12:29:19 AM - /opt/render/project/src/node_modules/next/dist/build/collect-build-traces.js
Oct 27 12:29:19 AM - /opt/render/project/src/node_modules/next/dist/build/index.js
Oct 27 12:29:19 AM - /opt/render/project/src/node_modules/next/dist/cli/next-build.js
Oct 27 12:29:19 AM - /opt/render/project/src/node_modules/next/dist/lib/commands.js
Oct 27 12:29:19 AM - /opt/render/project/src/node_modules/next/dist/bin/next
Oct 27 12:29:19 AM at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
Oct 27 12:29:19 AM at /opt/render/project/src/node_modules/next/dist/server/require-hook.js:54:36
Oct 27 12:29:19 AM at Function.resolve (node:internal/modules/cjs/helpers:125:19)
Oct 27 12:29:19 AM at loadPlugin (/opt/render/project/src/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js:49:32)
Oct 27 12:29:19 AM at /opt/render/project/src/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js:157:56
Oct 27 12:29:19 AM at Array.map (<anonymous>)
Oct 27 12:29:19 AM at getPostCssPlugins (/opt/render/project/src/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js:157:47)
Oct 27 12:29:19 AM at async /opt/render/project/src/node_modules/next/dist/build/webpack/config/blocks/css/index.js:124:36
Oct 27 12:29:19 AM at async /opt/render/project/src/node_modules/next/dist/build/webpack/loaders/next-font-loader/index.js:86:33
Oct 27 12:29:19 AM at async Span.traceAsyncFn (/opt/render/project/src/node_modules/next/dist/trace/trace.js:105:20)
Oct 27 12:29:19 AM
The error would suggest that the wrong version of node might be the issue, but the environment variable is set as in the render.yaml file (and being used in the logs).