score:0

for posterity's sake on this old issue. i found another option for d3@4.13.0, which is to add this to your package.json:

"resolutions": {
    "d3-selection": "1.3.0"
}

then deleting your yarn.lock and then yarn install the project again to help yarn handle the version resolutions.

fyi: my d3 dependencies in my package.json are (showing that i don't have d3-selection as a direct dependency):

    ...
    "d3": "4.13.0",
    "d3-geo-projection": "2.9.0",
    "d3-scale": "1.0.0",
    "d3-scale-chromatic": "3.0.0",
    ...

this seems to mainly be an issue with how yarn handle it's dependency resolution because, as a test, i was able to temporarily switch my project over to npm and had no issues.

this thread on github lists a few alternative solutions to what i posted above (and worked for me): https://github.com/d3/d3-selection/issues/185

score:1

i encountered this when i was mix using import * as d3 from 'd3'; and individual import { select } from 'd3-selection'. i overcome the issue by just using individual import, which i guess is the suggested way of doing things.

score:8

for future reference: i ran into a similar issue and it seems to be a problem between webpack, yarn and d3-transition. the later extends the function of d3-selection, which somehow results in multiple d3-selection versions in the yarn.lock file (as described in this issue).

in my case explicitly adding d3-selection, removing the lock file and then running yarn install again fixed the issue.

it seems like every update of d3-transition recreates this problem.


Related Query

More Query from same tag