browserslist / update-db

CLI tool to update caniuse-lite to refresh target browsers from Browserslist config
https://browsersl.ist/
MIT License
286 stars 57 forks source link

node:fs breaks --update-db on earlier node versions #35

Open lharrison1313 opened 2 months ago

lharrison1313 commented 2 months ago

When running the below command on node version 14.16.0 we get the following error:

Command: npx browserslist@latest --update-db Error:

Cannot find module 'node:fs'
Require stack:
/root/.npm/_npx/178/lib/node_modules/browserslist/node_modules/update-browserslist-db/index.js
/root/.npm/_npx/178/lib/node_modules/browserslist/cli.js

@ai I believe this commit https://github.com/browserslist/update-db/commit/2b56d5c6a99ddbad39c9b5a0c00ddc0de437329b switched the imports for all node libraries to the require(node:fs) format which may have broken it for older node versions. Could you potentially switch it back to the original form require(fs)?

ai commented 2 months ago

Node.js is note officially supported by Node.js team for a long time.

And we officially do not support it.

Do you have any reason why we should support it?

alegalviz commented 1 month ago

Same here, for now version 14.21.3 of node works fine, but yes, we should move to v18 based on https://endoflife.date/nodejs

Thank you!!

MisaoDev commented 1 month ago

This change is breaking some legacy pipelines that rely on browserslist and the --update-db option.

Is there any way to install an older version with npx?

Running npx update-browserslist-db@1.0.13 throws an error saying you should update npm or use npx browserslist@ --update-db, but that command always uses the latest update-db.

ai commented 1 month ago

I released 1.0.16 without node: but I really disappointment in the community. If you have legacy system and need help from somebody for supporting it, you need to pay for that work.

We have Open Collective, but I do not see your all there: https://opencollective.com/browserslist

MisaoDev commented 1 month ago

I released 1.0.16 without node: but I really disappointment in the community. If you have legacy system and need help from somebody for supporting it, you need to pay for that work.

We have Open Collective, but I do not see your all there: https://opencollective.com/browserslist

I'm sorry I wasn't expecting a fix, or legacy code to be supported. But rather pointing out that legacy code was unable to opt-out of the latest updates to update-db, due to the way both packages force you to use the latest version.

It is kinda odd that the package would enforce downloading from @latest though. I think as long as people are unable to run browserslist with an older version of update-db, you'll keep running into legacy projects breaking, as they can't stay with older versions. But maybe there is a way I'm not seeing and that's why I was asking.

Either way I'm sorry for being unable to collaborate but thank you for the fix.