title: "ReferenceError: document is not defined" while using WebStorm
body: <p>I am using WebStorm IDE and I'm writing a simple test for my HTML and JS. Here's the code:</p>
  <p>JavaScript (index.js):</p>
  <pre><code>const cool = document.getElementByClassName('error');
  
  cool.innerText = 'test';
  </code></pre>
  <p>HTML (index.html):</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang=&quot;en&quot;&gt;
  &lt;head&gt;
      &lt;meta charset=&quot;UTF-8&quot;&gt;
      &lt;title&gt;Title&lt;/title&gt;
      &lt;script src = &quot;index.js&quot;&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1 class=&quot;theWhat&quot;&gt;The DOM&lt;/h1&gt;
      &lt;p&gt;Hello World&lt;/p&gt;
      &lt;p class=&quot;error&quot;&gt;Error!&lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>The JavaScript does nothing to any of the 'p' tags and when I run it in it of itself, I et this error:</p>
  <p>const pars = document.querySelectorAll('p');
  ^
  ReferenceError: document is not defined
  at Object. (C:\Users\sethz\WebstormProjects\jscourse\chapter2\index.js:124:14)</p>
  <p>←[90m    at Module._compile (node:internal/modules/cjs/loader:1101:14)←[39m</p>
  <p>←[90m    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)←[39m</p>
  <p>←[90m    at Module.load (node:internal/modules/cjs/loader:981:32)←[39m</p>
  <p>←[90m    at Function.Module._load (node:internal/modules/cjs/loader:822:12)←[39m</p>
  <p>←[90m    at Function.executeUserEntryPoint as runMain←[39m</p>
  <p>←[90m    at node:internal/main/run_main_module:17:47←[39m</p>
  <p>Process finished with exit code 1</p>
  <p>Ive read it has to do with the interpreter, but I have no idea how to fix that.</p>
  <p><strong>NOTE:</strong></p>
  <p>I'm using Node.js.
  I've nevr had this problem before until I deleted it in order to update to the most recent WebStorm (2021)</p>