Deploying Vite React on Heroku: Loading PostCSS Plugin failed: Cannot find module 'caniuse-lite'

176 Views Asked by At

I have a simple React Vite app with node version (v18.14.0) and npm version (9.3.1) that I am deploying on Heroku using git push heroku main.

For some reason, today I did some minor changes and when I pushed, this is the error that I was shown:

remote: -----> Build
remote:        Running build
remote:
remote:        > [email protected] build
remote:        > vite build
remote:
remote:        vite v4.4.9 building for production...
remote:        transforming...
remote: node:internal/process/promises:288
remote:             triggerUncaughtException(err, true /* fromPromise */);
remote:             ^
remote:
remote: [Failed to load PostCSS config: Failed to load PostCSS config (searchPath: /tmp/build_fb8634e4): [Error] Loading PostCSS Plugin failed: Cannot find module 'caniuse-lite/data/features/mdn-css-backdrop-pseudo-element'
remote: Require stack:
remote: - /tmp/build_fb8634e4/node_modules/autoprefixer/data/prefixes.js
remote: - /tmp/build_fb8634e4/node_modules/autoprefixer/lib/autoprefixer.js
remote: - /tmp/build_fb8634e4/postcss.config.js
remote:
remote: (@/tmp/build_fb8634e4/postcss.config.js)
remote: Error: Loading PostCSS Plugin failed: Cannot find module 'caniuse-lite/data/features/mdn-css-backdrop-pseudo-element'

I tried updating all modules, caniuse-lite directly but nothing works. Anyone has an idea?

Many thanks!

0

There are 0 best solutions below