Build and Deploy failing since Oct 18 2022

Hi! Since Oct 18 all my deploys are failing (but the deploy preview is generated somehow).
If I go to the Netlify Dashboard and I retry clearing the cache, then it deploys successfully. But then it fails again if I create a new PR, I push a new commit or I merge to main.

The error I get is:
Cannot find module '@tailwindcss/forms'
Cannot find module '@tailwindcss/typography'
Cannot find module '@tailwindcss/aspect-ratio'

2:37:40 PM: web:build: node:internal/modules/cjs/loader:985
2:37:40 PM: web:build:   const err = new Error(message);
2:37:40 PM: web:build:               ^
2:37:40 PM: web:build: 
2:37:40 PM: web:build: Error: Cannot find module '@tailwindcss/forms'
2:37:40 PM: web:build: Require stack:
2:37:40 PM: web:build: - /opt/build/repo/packages/config/tailwind-preset.js
2:37:40 PM: web:build: - /opt/build/repo/apps/marketing-site/tailwind.config.js
2:37:40 PM: web:build: - /opt/build/repo/node_modules/tailwindcss/lib/cli.js
2:37:40 PM: web:build:     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
2:37:40 PM: web:build:     at Function.Module._load (node:internal/modules/cjs/loader:833:27)
2:37:40 PM: web:build:     at Module.require (node:internal/modules/cjs/loader:1057:19)
2:37:40 PM: web:build:     at require (node:internal/modules/cjs/helpers:103:18)
2:37:40 PM: web:build:     at Object.<anonymous> (/opt/build/repo/packages/config/tailwind-preset.js:88:5)
2:37:40 PM: web:build:     at Module._compile (node:internal/modules/cjs/loader:1155:14)
2:37:40 PM: web:build:     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
2:37:40 PM: web:build:     at Module.load (node:internal/modules/cjs/loader:1033:32)
2:37:40 PM: web:build:     at Function.Module._load (node:internal/modules/cjs/loader:868:12)
2:37:40 PM: web:build:     at Module.require (node:internal/modules/cjs/loader:1057:19) {
2:37:40 PM: web:build:   code: 'MODULE_NOT_FOUND',
2:37:40 PM: web:build:   requireStack: [
2:37:40 PM: web:build:     '/opt/build/repo/packages/config/tailwind-preset.js',
2:37:40 PM: web:build:     '/opt/build/repo/apps/marketing-site/tailwind.config.js',
2:37:40 PM: web:build:     '/opt/build/repo/node_modules/tailwindcss/lib/cli.js'
2:37:40 PM: web:build:   ]
2:37:40 PM: web:build: }
2:37:40 PM: web:build: npm ERR! Lifecycle script `build:css` failed with error:
2:37:40 PM: web:build: npm ERR! Error: command failed

BTW, this is a monorepo project.

What I tried:

  • adding those packages to the nohoist array in the package.json file following these thread: https://github.com/tailwindlabs/tailwindcss-forms/issues/31
  • moving those libraries from the devDependencies to the dependencies array
  • updating the libraries to a newer version

I don’t know what else to do.
I’d appreciate any help!
Thanks!
Vero

This could be a known limitation. Here’s an analysis (from an internal discussion) in the past which could be relevant to you too:

We’re saving the build and workspace cache correctly, however there seems to be a flaw. Since we’re only saving the package-sha for the top-level package.json, we’re not able to detect changes in the folder-level package.json. In this customer’s case, that’s exactly the problem. They were changing the dependencies in one of their sub-folders, but their root package.json was unchanged. This is why, we do not trigger npm install and thus, the problem of missing dependency.

Could you confirm if this is applying to you as well? That is, does your build always work if you change even a single character in your top-level package.json?

If yes, you’re affected by this too and this is on our roadmap to fix.

Hi! Thanks for your reply. I tried adding a ‘silly’ change on the package.json file and it seems the build was successful. I understand this will fail again everytime we add or update a package, right? Do you know when this is going to be fixed?

Hey there, @nykka :wave:

Unfortunately I do not have an estimate time right now. Apologies, I know this isn’t the answer you were hoping for!