lezer-parser / lezer

Dev utils and issues for the Lezer core packages
33 stars 1 forks source link

tree.children is undefined in @lezer/common #46

Closed gtm-nayan closed 10 months ago

gtm-nayan commented 10 months ago

When upgrading from v1.0.3 to v1.1.0, I ran into this error coming from the @lezer/common package:

CodeMirror plugin crashed: TypeError: tree.children is undefined
    hasChild index.js:1244
    nextChild index.js:724
    enterChild index.js:1008
    firstChild index.js:1020
    highlightRange index.js:364
    highlightRange index.js:372
    highlightRange index.js:372
    highlightTree index.js:295
    buildDeco index.js:1741
    update index.js:1733
    update index.js:1986
    updatePlugins index.js:6821
    update index.js:6727
    _dispatch index.js:6585
    dispatch index.js:6653
marijnh commented 10 months ago

You probably have multiple different versions of @lezer/common in your tree, breaking instanceof checks. Remove your package lock and reinstall your dependencies.

gtm-nayan commented 10 months ago

Ahh, thanks.

marijnh commented 10 months ago

Could you tell me which npm version you are using?

gtm-nayan commented 10 months ago

It was pnpm in my case, v8.7.1.

marijnh commented 10 months ago

I think upgrading to npm 9.x should make it properly deduplicate when upgrading packages (but I'm not sure that hold in all situations)