角度2错误加载system-config.js

时间:2016-09-09 13:52:12

标签: angular angular-cli

我尝试将http.get添加到我的角度应用中。现在它非常小,我只是证明功能。所以我是Angular的初学者。应用运行正常,直到我尝试添加http.get功能。如果我只删除http.get请求,我测试应用程序是否再次运行。它没。我必须删除所有其他功能,如错误处理程序功能。 Angular称应用程序构建成功。但是浏览器控制台会返回错误:

15:29:48.530 Error: @http://localhost:4200/system-config.js:35:5
    Call@http://localhost:4200/vendor/es6-shim/es6-shim.js:289:14
    forEach@http://localhost:4200/vendor/es6-shim/es6-shim.js:1295:14
    @http://localhost:4200/system-config.js:34:1
    Zone</ZoneDelegate</ZoneDelegate.prototype.invoke@http://localhost:4200/vendor/zone.js/dist/zone.js:323:20
    Zone</Zone</Zone.prototype.run@http://localhost:4200/vendor/zone.js/dist/zone.js:216:25
    scheduleResolveOrReject/<@http://localhost:4200/vendor/zone.js/dist/zone.js:571:53
    Zone</ZoneDelegate</ZoneDelegate.prototype.invokeTask@http://localhost:4200/vendor/zone.js/dist/zone.js:356:24
    Zone</Zone</Zone.prototype.runTask@http://localhost:4200/vendor/zone.js/dist/zone.js:256:29
    drainMicroTaskQueue@http://localhost:4200/vendor/zone.js/dist/zone.js:474:26
    ZoneTask/this.invoke@http://localhost:4200/vendor/zone.js/dist/zone.js:426:22

    Evaluating http://localhost:4200/system-config.js
    Error loading http://localhost:4200/system-config.js1zone.js:323:20
Zone</ZoneDelegate</ZoneDelegate.prototype.invoke()zone.js:323
Zone</Zone</Zone.prototype.run()zone.js:216
scheduleResolveOrReject/<()zone.js:571
Zone</ZoneDelegate</ZoneDelegate.prototype.invokeTask()zone.js:356
Zone</Zone</Zone.prototype.runTask()zone.js:256
drainMicroTaskQueue()zone.js:474
ZoneTask/this.invoke()zone.js:426

之前我从未打开过bowser控制台,因为应用程序运行良好。我删除了我用http.get添加的所有功能。但现在我得到同样的错误。我关闭了浏览器控制台,应用程序再次运行良好。如果我在加载应用程序后打开控制台,则没有错误消息。当我打开它之前停止上面的错误消息。我不明白system-config.js为什么或出了什么问题。我永远不会更改该文件,它是由angular cli自动创建的。

system-config.js中的第35行是:

    cliSystemConfigPackages[barrelName] = { main: 'index' };

1 个答案:

答案 0 :(得分:0)

我真的不知道为什么会出现错误消息,以便在Firefox中打开开发人员工具时出现错误消息。只有在加载之前打开控制台时,Chromium才会这样做。

但http的错误是另一个。我在这里找到了解决方案: Angular 2 No provider for Http