Accepted answer

It looks like the API you are using is from d3 version 3 (current version is 5). So, I recommend uninstall d3 dependency and install d3@3. You also do not need to install modules like 'd3-shape', because they were introduced in version 5.

Here is the working example of your code:

More Query from same tag