I have an application written in electron and nodejs that I am trying to run. It uses the module [portscanner](https://www.npmjs.com/package/portscanner) to check for an open port in a particular range:

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

})

```

However, I am getting this error:

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

```

Even though the range I have is clearly less than 65536 and greater than 0.

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.