ng serve error localhost could NOT be bound
See original GitHub issuePlease provide us with the following information:
OS?
Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) Mac OSX El Capitan
Versions.
Please run
ng --version
. If there’s nothing outputted, please run in a Terminal:node --version
and paste the result here:
angular-cli: 1.0.0-beta.16 node: 4.6.0 os: darwin x64
Repro steps.
Was this an app that wasn’t created using the CLI? What change did you do on your code? etc. A lot of changes but the backend guy can work with cli and use ng serve
The log given by the failure.
Normally this include a stack trace and some more information.
ng serve
Provided host localhost could NOT be bound. Please provide a different host address or hostname Error: Provided host localhost could NOT be bound. Please provide a different host address or hostname at Error (native) at /usr/local/lib/node_modules/angular-cli/node_modules/portfinder/lib/portfinder.js:139:27 at /usr/local/lib/node_modules/angular-cli/node_modules/portfinder/node_modules/async/lib/async.js:52:16 at /usr/local/lib/node_modules/angular-cli/node_modules/portfinder/node_modules/async/lib/async.js:264:21 at /usr/local/lib/node_modules/angular-cli/node_modules/portfinder/node_modules/async/lib/async.js:44:16 at /usr/local/lib/node_modules/angular-cli/node_modules/portfinder/lib/portfinder.js:117:16 at Server.onError (/usr/local/lib/node_modules/angular-cli/node_modules/portfinder/lib/portfinder.js:54:14) at Server.g (events.js:260:16) at emitOne (events.js:77:13) at Server.emit (events.js:169:7) at emitErrorNT (net.js:1269:8) at nextTickCallbackWith2Args (node.js:442:9) at process._tickCallback (node.js:356:17)
Mention any other details that might be useful.
Thanks for your help
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (2 by maintainers)
It seems like there is some problem binding to localhost. Can you try
ng serve --host 0.0.0.0
instead?If someone still phasing this(mac os), you need to edit
/etc/hosts
and make sure you have this line:127.0.0.1 localhost