browserslist / update-db

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

Cannot find module "browserslist" on Windows 10 #1

Closed alexanderanchishkin closed 2 years ago

alexanderanchishkin commented 2 years ago

When I try command "npx update-browserslist-db@latest" I got error: "Error: Cannot find module 'browserslist'". I suppose it occurs because package is installing every time I try this command (because in package.json of update-browserslist-db name of command is browserslist-lint) and package tries to require("browserslist") which can't be find from global scope. I tried npm i -g browserslist but no result. Command "npx browserslist-lint" works correctly. Is regulary installing of update-browserslist-db expected?

ai commented 2 years ago

What npm version do you have?

alexanderanchishkin commented 2 years ago

npm 6.14.16

ai commented 2 years ago

The current version is 8.x. Seems like you have an issue because of old version.

Can you update?

I will add warning for the old npm if update will help.

alexanderanchishkin commented 2 years ago

Yes it works. Thanks! It would be better if you will add warning for the old npm.

But npx browserslist-lint still works for old versions. Maybe is it possible to save support for npm 6.x?

ai commented 2 years ago

the problem is with peerDependencies in update-browserslist-db. browserslist has update-browserslist-db in direct dependencies and we can’t add browserslist to update-browserslist-db without creating a dependencies loop.

The solution is to use old npx browserslist@latest --update-db for now on old npm.

I think I will add a warning and change the CLI command for old npm.

ai commented 2 years ago

Fixed 5974df1

ai commented 2 years ago

Released in update-browserslist-db@1.0.5

romanlex commented 8 months ago

It seems this is an environment problem, not npm 6 problem Maybe author after installing the new version of npm affected this environment But I send pr with changed text for old version on npm

ai commented 8 months ago

Maybe. But since npm 6 is very old I do not want to spend my time on it.