const portfinder = require('portfinder');

portfinder.getPort({
port: 6000,
stopPort: 6999
},(err, port) => {
console.log(port)
});