npx browserslist@latest --update-db does not work with yarn workspaces

See original GitHub issue

Running npx browserslist@latest --update-db in the project root:

npx: installed 5 in 1.579s
Current version: 1.0.30001154
New version: 1.0.30001154
Removing old caniuse-lite from lock file
Installing new caniuse-lite version
$ yarn add caniuse-lite
error Running this command will add the dependency to the workspace root rather than the workspace itself, which might not be what you want - if you really meant it, make it explicit by running this command again with the -W flag (or --ignore-workspace-root-check).
Error: Command failed: yarn add caniuse-lite
error Running this command will add the dependency to the workspace root rather than the workspace itself, which might not be what you want - if you really meant it, make it explicit by running this command again with the -W flag (or --ignore-workspace-root-check).

Running npx browserslist@latest --update-db inside a workspace:

npx: installed 5 in 1.576s
No lockfile found. Run "npm install", "yarn install" or "pnpm install"

Workaround

Note: this isn’t necessary anymore after https://github.com/browserslist/browserslist/pull/553

  1. Run npx browserslist@latest --update-db in the project root, let it fail
  2. Run yarn add caniuse-lite && yarn remove caniuse-lite inside the workspace

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:19
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
fnunecommented, Nov 4, 2020

Adding -W doesn’t break if you’re not inside a workspace. Just tested it:

 ~/Development/nay => yarn add -W caniuse-lite
yarn add v1.22.10
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[...]
[4/5] Linking dependencies...
[5/5] Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ caniuse-lite@1.0.30001154
info All dependencies
└─ caniuse-lite@1.0.30001154
Done in 3.05s.
 ~/Development/nay => yarn remove -W caniuse-lite
yarn remove v1.22.10
[1/2] Removing module caniuse-lite...
[2/2] Regenerating lockfile and installing missing dependencies...
[...]
success Uninstalled packages.
Done in 3.03s.
3reactions
aicommented, Nov 9, 2020

The fix was released in 4.14.7

Read more comments on GitHub >

github_iconTop Results From Across the Web

npx browserslist@latest --update-db does not work with yarn ...
Running npx browserslist@latest --update-db in the project root: npx: installed 5 in 1.579s Current version: 1.0.30001154 New version: ...
Read more >
caniuse-lite is outdated. Please run next command `npm ...
Try this it solved my problem npx browserslist@latest --update-db ... caniuse-db and caniuse-lite entries in my yarn.lock and doing a yarn .
Read more >
browserslist | Yarn - Package Manager
The config to share target browsers and Node.js versions between different front-end tools. It is used in:.
Read more >
Caniuse-lite is outdade, please run `npx browserslist@latest
While running commands in an NX workspace, this warning kept popping up so I tried to fix it by running the specified command....
Read more >
lerna-debug.log · master · wax / wax-prosemirror - Coko GitLab
12 error Browserslist: caniuse-lite is outdated. Please run: 23. 12 error npx browserslist@latest --update-db.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found