在遵循本教程时。这是我得到的错误。唯一的区别是我声明了一个指令而不是组件,尽管它在本地开发中工作正常,但是当通过 npm 安装时,它会给出以下错误:
Error: StaticInjectorError(AppModule)[ApplicationRef -> NgZone]:
StaticInjectorError(Platform: core)[ApplicationRef -> NgZone]:
NullInjectorError: No provider for NgZone!
at NullInjector.get (VM1509 core.umd.js:1063)
at resolveToken (VM1509 core.umd.js:1316)
at tryResolveToken (VM1509 core.umd.js:1266)
at StaticInjector.get (VM1509 core.umd.js:1161)
at resolveToken (VM1509 core.umd.js:1316)
at tryResolveToken (VM1509 core.umd.js:1266)
at StaticInjector.get (VM1509 core.umd.js:1161)
at resolveNgModuleDep (VM1509 core.umd.js:9322)
at _createClass (VM1509 core.umd.js:9367)
at _createProviderInstance$1 (VM1509 core.umd.js:9339)
console.(anonymous function) @ preview-45b825bb367532ab5b87a.js:1
(anonymous) @ main.ts:26
ZoneDelegate.invoke @ zone.js:388
Zone.run @ zone.js:138
(anonymous) @ zone.js:872
ZoneDelegate.invokeTask @ zone.js:421
Zone.runTask @ zone.js:188
drainMicroTaskQueue @ zone.js:595
Promise.then (async)
scheduleMicroTask @ zone.js:578
ZoneDelegate.scheduleTask @ zone.js:410
Zone.scheduleTask @ zone.js:232
Zone.scheduleMicroTask @ zone.js:252
scheduleResolveOrReject @ zone.js:862
ZoneAwarePromise.then @ zone.js:962
PlatformRef.bootstrapModule @ application_ref.ts:275
execute @ main.ts:19