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: Cannot read properties of undefined (reading 'replace')

See original GitHub issue

Hey 👋

Thank you for the great project!

I’m currently trying to update my yarn.lock and faced the issue that integrity is missing in my yarn.lock. Short example of what I have now:


caniuse-lite@^1.0.30001202:
  version "1.0.30001242"
  resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001242.tgz#04201627abcd60dc89211f22cbe2347306cda46b"

caniuse-lite@^1.0.30001219:
  version "1.0.30001223"
  resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001223.tgz#39b49ff0bfb3ee3587000d2f66c47addc6e14443"

caniuse-lite@^1.0.30001228:
  version "1.0.30001228"
  resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001228.tgz#bfdc5942cd3326fa51ee0b42fbef4da9d492a7fa"

That’s why it tries to access the third line and cannot find it

Do you think we can add if here?

https://github.com/browserslist/browserslist/blob/2c292532b068606202567ddefc17415ab92e472d/update-db.js#L154-L159

Let me know if I can fix it

More details:

  1. Versions
➜ npx --version
8.0.0
➜ yarn --version
1.22.17
➜ node -v
v16.11.0
  1. yarn lockfile v1
  2. Project where I run it – https://github.com/Beraliv/beraliv.dev

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Ponjimoncommented, Dec 23, 2021

I’m not sure if I’m doing something wrong, but I still get exactly the same error when running npx browserslist@latest --update-db.

$ npx browserslist@latest --update-db
Latest version:     1.0.30001292
[redacted]/node_modules/@babel/core/node_modules/browserslist/update-db.js:145
        lines[3] = latest.dist.integrity ? lines[3].replace(
                                                    ^

TypeError: Cannot read properties of undefined (reading 'replace')
    at [redacted]/node_modules/@babel/core/node_modules/browserslist/update-db.js:145:53
    at Array.forEach (<anonymous>)
    at updateYarnLockfile ([redacted]/node_modules/@babel/core/node_modules/browserslist/update-db.js:134:10)
    at updateLockfile ([redacted]/node_modules/@babel/core/node_modules/browserslist/update-db.js:199:12)
    at updatePackageManually ([redacted]/node_modules/@babel/core/node_modules/browserslist/update-db.js:205:22)
    at updateDB ([redacted]/node_modules/@babel/core/node_modules/browserslist/update-db.js:291:5)
    at Object.<anonymous> ([redacted]/node_modules/@babel/core/node_modules/browserslist/cli.js:40:3)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)

Do I need to explicitly add browserlist as a dependency or add the latest version to the resolutions field in package.json?

1reaction
aicommented, Dec 9, 2021

@Beraliv sorry, I am in computer game (Black book). Hope to finish it before the weekend.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read properties of undefined ...
In your example Uncaught TypeError: Cannot read properties of undefined (reading 'replace' ) can occur only if your variables song and/or ...
Read more >
TypeError: Cannot read property 'replace' of Undefined in JS
The "Cannot read property 'replace' of undefined" error occurs when calling the replace() method on an undefined value. To solve the error, provide...
Read more >
Cannot read property 'replace' of Undefined in JS - Isotropic
Cannot read property 'replace' of Undefined in JS ... method such as TypeError: Cannot read properties of undefined (reading 'replace') .
Read more >
TypeError: Cannot read property 'replace' of undefined
So I tried to learn how to do this on my own by taking two video courses about node and cheerio on udemy...
Read more >
next/image - TypeError: Cannot read properties of undefined ...
The image is a jpeg with a system defined metadata Content-Type of image/jpg . TypeError: Cannot read properties of undefined (reading 'replace ...
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