D3.js : Uncaught TypeError: Cannot read property 'document' of undefined
<p>I'm having a really weird problem with d3.js initilization. In the d3.js script,  at the very beginning, it tries to get <code>var d3_document = this.document;</code> but it pops the following error:</p>

<pre><code>Uncaught TypeError: Cannot read property 'document' of undefined
</code></pre>

<p>when debugging, <code>this.document</code> returns undefined. </p>

<p>I'm using <code>yo webapp</code> to generate the project. It uses bower as package manager and gulp for the build process (that uses babel for the ES2015 features).</p>

<p>The funny thing is that I've tested it with xampp and it works fine!</p>

<p>I would appreciate some advice!Thnx!</p>