我是角度5的新手,我尝试运行角度5项目得到以下错误 " ng服务错误localhost无法绑定"。任何人都可以帮助我。
example:
D:\workspace\newapp>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`enter code here`
at D:\workspace\newapp\node_modules\portfinder\lib\portfinder.js:139:27
at D:\workspace\newapp\node_modules\portfinder\node_modules\async\lib\async.
js:52:16
at D:\workspace\newapp\node_modules\portfinder\node_modules\async\lib\async.
js:264:21
at D:\workspace\newapp\node_modules\portfinder\node_modules\async\lib\async.
js:44:16
at D:\workspace\newapp\node_modules\portfinder\lib\portfinder.js:117:16
at Server.onError (D:\workspace\newapp\node_modules\portfinder\lib\portfinde
r.js:54:14)
at Object.onceWrapper (events.js:315:30)
at emitOne (events.js:116:13)
at Server.emit (events.js:211:7)
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)
答案 0 :(得分:3)
在Visual tutorial terminal / cmd prmt。
中使用此命令ng serve --host 0.0.0.0
答案 1 :(得分:0)
我找到了解决方案
example:
D:\workspace\newapp>ng serve --host 192.168.43.131 --port 4200