Skip to content

ReferenceError – d3 is not defined


I just tested it before changing the code

I copied the code and simply changed the .html-file

<script src="//" charset="utf-8"></script>
<script src="//"></script>
<script src="//"></script>


<script src="" charset="utf-8"></script>
<script src=""></script>
<script src=""></script>

then I get the following errors:

ReferenceError: d3 is not defined

As I have almost no knowledge of d3 or javascript.

Can anyone give me a hint to what is causing the errors and how I should correct the code please?

I’ve already seen this post and tried d3 is not defined – ReferenceError


From the error screenshot, it seems you’re executing heatmap.js in a console with node.js. The issue is that the heatmap.js script, and the other scripts of the project, are designed to be executed in a browser with an HTML page, and not in isolation in a node terminal. To run a D3 project you need a local web server, and then access the localhost:{port number} on the browser. Here is a tutorial on how to do it with with node.js