title: node v5.*  TypeError: Cannot convert undefined or null to object in debug
body: <p>I tried to debug my Node.js code and I got a weird error:</p>
  
  <blockquote>
    <p>‌TypeError: Cannot convert undefined or null to object</p>
  </blockquote>
  
  <p>But if I try to put some code in if-else or other things it works fine.</p>
  
  <p>I tried to simple my code to be only this:</p>
  
  <pre><code>var a = {
      foo:"something"
  };
  var b = 5;
  </code></pre>
  
  <p>When I debug it and setting break-point on <code>var b = 5;</code>, and in the console I try to access <code>a.foo</code> it throws an error:</p>
  
  <pre><code>‌TypeError: Cannot convert undefined or null to object
      at t.evaluate (eval at &lt;anonymous&gt; (c:\projects\main\TestProject\test.js:1:11), &lt;anonymous&gt;:171:45)
      at DebugCommandProcessor.r.processDebugJSONRequest (eval at &lt;anonymous&gt; (c:\projects\main\TestProject\test.js:1:11), &lt;anonymous&gt;:383:15)
      at Object.&lt;anonymous&gt; (c:\projects\main\TestProject\test.js:2:1)
      at Module._compile (module.js:425:26)
      at Object.Module._extensions..js (module.js:432:10)
      at Module.load (module.js:356:32)
      at Function.Module._load (module.js:311:12)
      at Module.runMain [as _onTimeout] (module.js:457:10)
      at Timer.listOnTimeout (timers.js:92:15)
  </code></pre>
  
  <p>I remembered that I was able to debug before couple of weeks(I had Node.js v0.12.*), so I decided to downgrade my Node.js(v5.1.1) until it will work.</p>
  
  <p>So the Node.js version that works is: v4.2.3. All of Node.js v5.* throws the same error.</p>
  
  <p>My environment is:</p>
  
  <ul>
  <li>Windows 10.</li>
  <li>WebStorm 11.0.1</li>
  <li>Node.js v5.*</li>
  </ul>
  
  <p>Many thanks for your help!</p>