question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

--update-db fails with Yarn v2 lock file

See original GitHub issue

Description

When using Yarn v2, running npx browserslist@latest --update-db fails with the error Cannot read property '1' of null. Calling yarn run browserslist --update-db gives the error with some more details:

C:\inetpub\wwwroot\blt\.yarn\cache\browserslist-npm-4.16.1-37866cfd90-56f51464c3.zip\node_modules\browserslist\update-db.js:57
    if (match[1]) return match[1]
             ^

TypeError: Cannot read property '1' of null
    at getCurrentVersion (C:\inetpub\wwwroot\blt\.yarn\cache\browserslist-npm-4.16.1-37866cfd90-56f51464c3.zip\node_modules\browserslist\update-db.js:57:14)
    at updateDB (C:\inetpub\wwwroot\blt\.yarn\cache\browserslist-npm-4.16.1-37866cfd90-56f51464c3.zip\node_modules\browserslist\update-db.js:179:17)
    at Object.<anonymous> (C:\inetpub\wwwroot\blt\.yarn\cache\browserslist-npm-4.16.1-37866cfd90-56f51464c3.zip\node_modules\browserslist\cli.js:40:3)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.external_module_.Module._load (C:\inetpub\wwwroot\blt\.pnp.js:4980:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47
package.json ```json { "name": "blt", "version": "1.0.0", "main": "index.js", "license": "MIT", "dependencies": { "browserslist": "^4.16.1" } } ```
yarn.lock ```yaml # This file is generated by running "yarn install" inside your project. # Manual changes might be lost - proceed with caution!

__metadata: version: 4 cacheKey: 7

“blt@workspace:.”: version: 0.0.0-use.local resolution: “blt@workspace:.” dependencies: browserslist: ^4.16.1 languageName: unknown linkType: soft

“browserslist@npm:^4.16.1”: version: 4.16.1 resolution: “browserslist@npm:4.16.1” dependencies: caniuse-lite: ^1.0.30001173 colorette: ^1.2.1 electron-to-chromium: ^1.3.634 escalade: ^3.1.1 node-releases: ^1.1.69 bin: browserslist: cli.js checksum: 56f51464c3a3bd9b2aeb75ded1dc3fce5ad91bd6d84187aba812a78ba66b69bc97c2de25a1b7409daac3c0049e979bf0faa6cca4aacce0abcaf3107c250ce3fb languageName: node linkType: hard

“caniuse-lite@npm:^1.0.30001173”: version: 1.0.30001177 resolution: “caniuse-lite@npm:1.0.30001177” checksum: a43eafb57339093bf3343bc6f57cc21ff6779af44c9a26cc078c3b335db12598179d1333a1cbdd6fd25a2c08cfc550c78538b48fbb3e9c383f46460a1c32a1c0 languageName: node linkType: hard

“colorette@npm:^1.2.1”: version: 1.2.1 resolution: “colorette@npm:1.2.1” checksum: 1cc21ad4b84777a424794f78b6bb6a44b614ae17dcea91762199339f8047598e6d981249eeef7ea588c99eaf062be8fcdcd4866c112998922ed854db6dde96f9 languageName: node linkType: hard

“electron-to-chromium@npm:^1.3.634”: version: 1.3.639 resolution: “electron-to-chromium@npm:1.3.639” checksum: bf8b79e55d50ddcd55b029feb161a56250f3a8980b5c11b47055fd983b9306ad8c69c0501eef9317e0e03f8c5d69fecb97338c08df8c9456953f5741646794c1 languageName: node linkType: hard

“escalade@npm:^3.1.1”: version: 3.1.1 resolution: “escalade@npm:3.1.1” checksum: 1e31ff50d66f47cd0dfffa702061127116ccf9886d1f54a802a7b3bc95b94cab0cbf5b145cc5ac199036df6fd9d1bb24af1fa1bfed87c94879e950fbee5f86d1 languageName: node linkType: hard

“node-releases@npm:^1.1.69”: version: 1.1.69 resolution: “node-releases@npm:1.1.69” checksum: 240b2534f32c8bbdfefb1fb052d2b1c198f3a745141ce245c6c5241a6efefae22d356b66965e5250869013c3c4777050cdca78d39f3b46965166b5f3e02b08d7 languageName: node linkType: hard

</details>

Here's a zip of the whole project (just `package.json` and various Yarn artifacts): [sscce.zip](https://github.com/browserslist/browserslist/files/5816478/sscce.zip)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:23
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

13reactions
arcaniscommented, Feb 2, 2021

Just merged yarn up -R. It will be released along with the next release (hopefully Yarn 3!) in a month or two (it can already be used now for people who build Yarn from sources, which is a very easy thing).

6reactions
CharlesStovercommented, Aug 26, 2021

For anyone looking for solutions, the common-needed npx browserslist@latest --update-db can be replaced with yarn up -R caniuse-lite when using Yarn2. 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error upgrading dependencies in yarn.lock file with yarn up in ...
I learned that you can't upgrade individual dependencies in the yarn-lock file, you have to upgrade package with the dependency in the package. ......
Read more >
Bountysource
update-db fails with Yarn v2 lock file.
Read more >
The program cannot be packaged - Support - Redash Discourse
Hello developer,after the project download dependency ,run 'npm run build',but I can't get the package file. Software version
Read more >
browserslist | Yarn - Package Manager
Updated Firefox ESR. 4.21.3. Improved unknown region and unknown feature error (by Alexander Chabin). 4.21.2.
Read more >
Help me (newbie) - Support - Netlify Support Forums
Your project contains lock files generated by tools other than Yarn. ... 10:22:22 AM: info “fsevents@2.3.2” is an optional dependency and failed ......
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