angular-启动时出现 cli ng 服务器错误

angular-cli ng server errors on start up

我已经安装了 angular-cli 并正在尝试 'ng serve' 通过 "ng new [BLAH]FrontEnd" 创建的 Angular 项目,但我收到了这些错误:

粘贴站:http://pastebin.com/QB1D5PsF

这是怎么回事。当我导航到 http://localhost:4200/ 时,我看到:

Uncaught Error: Cannot find module "webpack-dev-server/client?http://localhost:4200/"(…)

尝试 npm start 而不是 ng serve 到 运行 使用 http://localhost:4200/

的服务器

试试这个

更新根目录中的 angular-cli 文件

"defaults": {
    "styleExt": "css",
    "component": {},
    "serve": {
      "port": 4200
    }
  }

将此添加到您的 package.json

"ng": "ng",
"start": "ng serve"