browserslist / caniuse-lite

A smaller version of caniuse-db, with only the essentials!
Creative Commons Attribution 4.0 International
547 stars 77 forks source link

Error: Loading PostCSS Plugin failed: Cannot find module 'caniuse-lite/data/features/mdn-css-backdrop-pseudo-element' #117

Closed bsaoptima closed 1 year ago

bsaoptima commented 1 year ago

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: [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: Error: Loading PostCSS Plugin failed: Cannot find module 'caniuse-lite/data/features/mdn-css-backdrop-pseudo-element'

Anyone aware of this?

ai commented 1 year ago

You need to update caniuse-lite

Try npx update-browserslist-db@latest

bsaoptima commented 1 year ago

Hi thank you for such a quick reply, but this does not work I still have the same error. I noticed that when I deleted my postccs.config.js file it worked (no errors in push) but obviously the rendering was not there. Do you need any other information to solve this?

ai commented 1 year ago
  1. What package manager do you use? pnpm, npm, yarn?
  2. Post somewhere your lock file and give me a link
bsaoptima commented 1 year ago
  1. I am using npm!
  2. https://pastebin.com/HV4HJ653

Sorry for the delay I got dragged in a work event! Thank you for the help!

ai commented 1 year ago

Everything looks good. Sorry, have no idea.

Maybe you have an issue with node_modules. Try to remove node_modules, npm cache clear --force and install dependencies again.

bsaoptima commented 1 year ago

Still not working, I'm not even sure that is a fault on your side. It might be Heroku.

ai commented 1 year ago

Maybe it is a problem in Heroku npm cache. Try to find a way to clean cache.

Also double check that you don’t have yarn.lock file.

But I checked that library itself work and it does. So very likely that it is a problem in your environment.

bsaoptima commented 1 year ago

Yes I managed to solve it, it was about the way git tracked my node modules directory so yeah totally a problem in my environment. For people that encounter this issue: https://devcenter.heroku.com/articles/troubleshooting-node-deploys#don-t-check-in-generated-directories (this solved my issue).

Thank you very much for being so responsive, this is why our engineering communities are very good!

yordis commented 1 year ago

In my case, I forgot that I had set resolutions at the root of the monorepo 🥲. Took me 5 mins to figure it out.

// maybe you did this!
"resolutions": {
    "caniuse-lite": "1.0.30001525"
  }