Angular v11 deploy fails with "Error: Cannot find module 'postcss'"

Site name: adenearnshaw-cv.netlify.app

I have updated my Angular site from v8 to v11. Everything successfully builds locally, but when creating a PR to merge into main, the Netlify Preview Deployment fails to build with what appears to be this error:


Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):

Error: Cannot find module 'postcss'

Steps already taken

  • Locally deleted all items in node_modules then did a clean install and build. Local build succeeds

  • Installed Netlify CLI and ran build locally with this. Local build succeeds

  • Used Netlfy CLI to deploy locally built preview (https://608db26481ef4dfa9d368c7c--adenearnshaw-cv.netlify.app/)

  • Added netlify.toml with build command CI= npm run build:prod. From log this invokes ng build --prod as expected, but remote build fails

  • Double checked PR for changes to file name casing - Non I can see

Related PR

github.com/adenearnshaw - Updating Angular to v11

Deploy Log

https://app.netlify.com/sites/adenearnshaw-cv/deploys/608da870f64537c94f08ab07

NPM debug log: /opt/buildhome/.npm/_logs/2021-05-01T19_15_07_213Z-debug.log

Any help would be greatly appreciated

Hey there :wave:

Thanks for contributing to the Netlify Forums! It looks like the same topic has been opened a few times. I am going to close this thread so that we can direct all conversation to a singular place. I will leave the following thread open for follow ups and questions: Angular v11 deploy fails with "Error: Cannot find module 'postcss'"

Best,
Hillary