由于getaddrinfo ENOTFOUND错误,无法启动使用angular-cli生成的angular2项目

Mad*_*u K 3 angular-cli angular

我正在使用Mac,OSX El Capitan 10.11.2,并尝试使用angular-cli启动angular2应用程序.根据文件,我运行了以下内容

$sudo ng new dashboard
$cd dashboard
$sudo ng serve
Password:
getaddrinfo ENOTFOUND localhost
Error: getaddrinfo ENOTFOUND localhost
    at errnoException (dns.js:28:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
Run Code Online (Sandbox Code Playgroud)

但我越来越高,我不明白.

小智 7

尝试使用此命令:ng serve --port 4200 --host 0.0.0.0