RangeError: "port" argument must be >= 0 and < 65536
<p>I have an application written in electron and nodejs that I am trying to run. It uses the module <a href="https://www.npmjs.com/package/portscanner" rel="noreferrer">portscanner</a> to check for an open port in a particular range:</p>

<pre><code>portscanner.findAPortNotInUse(3000, 3010, '127.0.0.1', function(error, port) {
  console.log("Free port: " + port)

})
</code></pre>

<p>However, I am getting this error:</p>

<pre><code>RangeError: "port" argument must be &gt;= 0 and &lt; 65536
    at assertPort (internal/net.js:17:11)
    at Server.listen (net.js:1389:5)
</code></pre>

<p>Even though the range I have is clearly less than 65536 and greater than 0.</p>

<p>Looking online, it seems to be an error in node v6 (I have v6.5.0). I am new to nodejs, and would greatly appreciate any help regarding how to fix this. Thanks.</p>