Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update portfinder to convert option.port to number
Hi! Got a strange error while working on an angular app. For some reason, when I try to get the server up it throws the error below.
Obviously, when it receives '8080', everything crashes and according to exports.basePort options.port always should be of a number type.

~ ng s
│net.js:1487
│      throw new errors.RangeError('ERR_SOCKET_BAD_PORT', options.port);
│      ^
│
│RangeError [ERR_SOCKET_BAD_PORT]: Port should be > 0 and < 65536. Received 80801.
│    at Server.listen (net.js:1487:13)
│    at Object.internals.testPort (/<projectPath>/node_modules/portfinder/lib/portfinder.js:69:18
│)
│    at Server.onError (/<projectPath>/node_modules/portfinder/lib/portfinder.js:60:15)
│    at Object.onceWrapper (events.js:254:19)
│    at Server.emit (events.js:159:13)
│    at emitErrorNT (net.js:1387:8)
│    at _combinedTickCallback (internal/process/next_tick.js:138:11)
│    at process._tickCallback (internal/process/next_tick.js:180:9)
  • Loading branch information
ni-kit committed Dec 10, 2017
1 parent 36613c1 commit c324c62
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/portfinder.js
Expand Up @@ -27,9 +27,9 @@ internals.testPort = function(options, callback) {
options = {};
}

options.port = options.port || exports.basePort;
options.host = options.host || null;
options.server = options.server || net.createServer(function () {
options.port = +options.port || exports.basePort;
options.host = options.host || null;
options.server = options.server || net.createServer(function () {
//
// Create an empty listener for the port testing server.
//
Expand Down

0 comments on commit c324c62

Please sign in to comment.