Npm run build fails for my NextJs app

My npm run build command fails with these two errors even though it builds just fine using Render.com’s Shell feature. What gives?

Jun 2 03:34:02 PM warn - Found lockfile missing swc dependencies, run next locally to automatically patch
Jun 2 03:34:06 PM Failed to compile.
Jun 2 03:34:06 PM
Jun 2 03:34:06 PM components/layout.tsx
Jun 2 03:34:06 PM An error occured in next/font.
Jun 2 03:34:06 PM
Jun 2 03:34:06 PM Error: Cannot find module ‘tailwindcss’
Jun 2 03:34:06 PM Require stack:
Jun 2 03:34:06 PM - /opt/render/project/src/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js

Jun 2 03:34:06 PM ./styles/Home.module.css
Jun 2 03:34:06 PM Error: Cannot find module ‘tailwindcss’
Jun 2 03:34:06 PM Require stack:
Jun 2 03:34:06 PM - /opt/render/project/src/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js

Hi Adam,

One thing to keep in mind is that the shell you have access to in the dashboard is running the last successful build/deploy of your service. So if something changed that broke the build process, it would not be present in the instance you’re accessing via the shell.

I’d suggest finding that last successful deploy and try rolling back to it to confirm it successfully builds again. Then inspect the diff between the successful and failing build.

Feel free to let me know if I can answer any other questions about this for you.

Regards,

Matt

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.