【发布时间】:2017-03-16 13:13:05
【问题描述】:
我遇到了 Angular 2 的问题。当我想启动服务器时,它得到了这个:
$ ng serve
Cannot read property 'config' of null
TypeError: Cannot read property 'config' of null
at Class.run (C:\Users\Damien\Desktop\application\node_modules\@angul ar\cli\tasks\serve.js:22:63)
at check_port_1.checkPort.then.port (C:\Users\Damien\Desktop\application\node_modules\@angular\cli\commands\serve.js:103:26)
at process._tickCallback (internal/process/next_tick.js:103:7)
我重新安装了 CLI,但没有其他工作。我可能是 json 文件?
【问题讨论】:
-
您的代码似乎有问题。您有一个具有名为
config的属性的东西。我们称它为Foo,所以它可能看起来像这样:class Foo { public config: any; };然后在其他地方你试图获得config的值,可能是这样的:let f = getFoo(); let c = f.config;问题是f是null. -
以下任何答案都回答了您的问题吗?
标签: angular angular-cli