我是Angular的新手。我试图关注this指南。 我一步一步地做了同样的事情,但我得到了一个错误。我错过了什么吗?
错误 columnNumber:31 fileName:&#34; http://localhost:4200/polyfills.bundle.js第597行&gt; EVAL&#34; lineNumber:814 消息:&#34;未捕获(在承诺中):TypeError: webpack_require .e不是函数\ nwebpackAsyncContext @ webpack-internal:///。/ src / $ $ _ lazy_route_resource:23:9 \ nSystemJsNgModuleLoader.prototype.loadAndCompile@webpack-internal:///./node_modules/@angular/core/esm5/core.js:6786:16 \ nSystemJsNgModuleLoader.prototype.load@webpack-internal:///./node_modules/@角/型芯/ esm5 / core.js:6770:55 \ nRouterConfigLoader.prototype.loadModuleFactory@webpack-internal:///./node_modules/@angular/router/esm5/router.js:4678:110 \ nRouterConfigLoader.prototype。负荷@的WebPack内部:///./node_modules/@angular/router/esm5/router.js:4658:47 \ nApplyRedirects.prototype.getChildConfig /&LT; @的WebPack内部:///./node_modules/@angular /router/esm5/router.js:2144:96\nMergeMapSubscriber.prototype._tryNext@webpack-internal:///./node_modules/rxjs/_esm5/operators/mergeMap.js:133:22\nMergeMapSubscriber.prototype._next@的WebPack内部:///./node_modules/rxjs/_esm5/operators/mergeMap.js:123:13 \ nSubscriber.prototy pe.next@webpack-internal:///./node_modules/rxjs/_esm5/Subscriber.js:100:13 \ nScalarObservable.prototype._subscribe@webpack-internal:///./node_modules/rxjs/_esm5/observable/ ScalarObservable.js:53:13 \ nObservable.prototype._trySubscribe@webpack-internal:///./node_modules/rxjs/_esm5/Observable.js:177:20 \ nObservable.prototype.subscribe@webpack-internal:/// ./node_modules/rxjs/_esm5/Observable.js:165:88\nMergeMapOperator.prototype.call@webpack-internal:///./node_modules/rxjs/_esm5/operators/mergeMap.js:97:16\nObservable.prototype .subscribe @的WebPack内部:///./node_modules/rxjs/_esm5/Observable.js:162:13 \ nMergeMapOperator.prototype.call@webpack-internal:///./node_modules/rxjs/_esm5/operators/mergeMap的.js:97:16 \ nObservable.prototype.subscribe@webpack-internal:///./node_modules/rxjs/_esm5/Observable.js:162:13 \ nCatchOperator.prototype.call@webpack-internal:///。 /node_modules/rxjs/_esm5/operators/catchError.js:83:16\nObservable.prototype.subscribe@webpack-internal:///./node_modules/rxjs/_esm5/Obser vable.js:162:13 \ nsubscribeToResult @的WebPack内部:///./node_modules/rxjs/_esm5/util/subscribeToResult.js:32:20 \ nMergeMapSubscriber.prototype._innerSub@webpack-internal:///./ node_modules / rxjs / _esm5 /运营商/ mergeMap.js:143:18 \ nMergeMapSubscriber.prototype._tryNext@webpack-internal:///./node_modules/rxjs/_esm5/operators/mergeMap.js:140:9 \ nMergeMapSubscriber.prototype ._next @的WebPack内部:///./node_modules/rxjs/_esm5/operators/mergeMap.js:123:13 \ nSubscriber.prototype.next@webpack-internal:///./node_modules/rxjs/_esm5/Subscriber的.js:100:13 \ nMapSubscriber.prototype._next@webpack-internal:///./node_modules/rxjs/_esm5/operators/map.js:88:9 \ nSubscriber.prototype.next@webpack-internal:// /./node_modules/rxjs/_esm5/Subscriber.js:100:13\nArrayObservable.prototype._subscribe@webpack-internal:///./node_modules/rxjs/_esm5/observable/ArrayObservable.js:121:17\nObservable。 prototype._trySubscribe@webpack-internal:///./node_modules/rxjs/_esm5/Observable.js:177:20 \ nObservable.prototype.subscribe@webpa CK-内部:///./node_modules/rxjs/_esm5/Observable.js:165:88 \ nMapOperator.prototype.call@webpack-internal:///./node_modules/rxjs/_esm5/operators/map.js: 60:16 \ nObservable.prototype.subscribe@webpack-internal:///./node_modules/rxjs/_esm5/Observable.js:162:13 \ nMergeMapOperator.prototype.call@webpack-internal:///./node_modules/ rxjs / _esm5 /运营商/ mergeMap.js:97:16 \ nObservable.prototype.subscribe@webpack-internal:///./node_modules/rxjs/_esm5/Observable.js:162:13 \ nFirstOperator.prototype.call@webpack -internal:///./node_modules/rxjs/_esm5/operators/first.js:74:16 \ nObservable.prototype.subscribe@webpack-internal:///./node_modules/rxjs/_esm5/Observable.js:162 :13 \ nCatchOperator.prototype.call@webpack-internal:///./node_modules/rxjs/_esm5/operators/catchError.js:83:16 \ nObservable.prototype.subscribe@webpack-internal:///./node_modules /rxjs/_esm5/Observable.js:162:13\nMapOperator.prototype.call@webpack-internal:///./node_modules/rxjs/_esm5/operators/map.js:60:16\nObservable.prototype.subscribe@我们bpack内部:///./node_modules/rxjs/_esm5/Observable.js:162:13 \ nsubscribeToResult @的WebPack内部:///./node_modules/rxjs/_esm5/util/subscribeToResult.js:32:20 \ nMergeMapSubscriber.prototype._innerSub@webpack-internal:///./node_modules/rxjs/_esm5/operators/mergeMap.js:143:18 \ nMergeMapSubscriber.prototype._tryNext@webpack-internal:///./node_modules/rxjs/ _esm5 /运营商/ mergeMap.js:140:9 \ nMergeMapSubscriber.prototype._next@webpack-internal:///./node_modules/rxjs/_esm5/operators/mergeMap.js:123:13 \ nSubscriber.prototype.next@webpack -internal:///./node_modules/rxjs/_esm5/Subscriber.js:100:13 \ nScalarObservable.prototype._subscribe@webpack-internal:///./node_modules/rxjs/_esm5/observable/ScalarObservable.js:53 :13 \ nObservable.prototype._trySubscribe@webpack-internal:///./node_modules/rxjs/_esm5/Observable.js:177:20 \ nObservable.prototype.subscribe@webpack-internal:///./node_modules/rxjs /_esm5/Observable.js:165:88\nMergeMapOperator.prototype.call@webpack-internal:///./node_modules/rxjs/_esm5/op erators / mergeMap.js:97:16 \ nObservable.prototype.subscribe@webpack-internal:///./node_modules/rxjs/_esm5/Observable.js:162:13 \ nLastOperator.prototype.call@webpack-internal:/ //./node_modules/rxjs/_esm5/operators/last.js:43:16\nObservable.prototype.subscribe@webpack-internal:///./node_modules/rxjs/_esm5/Observable.js:162:13\nMapOperator .prototype.call @的WebPack内部:///./node_modules/rxjs/_esm5/operators/map.js:60:16 \ nObservable.prototype.subscribe@webpack-internal:///./node_modules/rxjs/_esm5 /Observable.js:162:13\nMapOperator.prototype.call@webpack-internal:///./node_modules/rxjs/_esm5/operators/map.js:60:16\nObservable.prototype.subscribe@webpack-internal: ///./node_modules/rxjs/_esm5/Observable.js:162:13 \ nMapOperator.prototype.call@webpack-internal:///./node_modules/rxjs/_esm5/operators/map.js:60:16 \ nObservable.prototype.subscribe@webpack-internal:///./node_modules/rxjs/_esm5/Observable.js:162:13 \ nCatchOperator.prototype.call@webpack-internal:///./node_modules/rxjs/_esm5/运营商/猫chError.js:83:16 \ nObservable.prototype.subscribe@webpack-internal:///./node_modules/rxjs/_esm5/Observable.js:162:13 \ nMergeMapOperator.prototype.call@webpack-internal:/// ./node_modules/rxjs/_esm5/operators/mergeMap.js:97:16\nObservable.prototype.subscribe@webpack-internal:///./node_modules/rxjs/_esm5/Observable.js:162:13\nMergeMapOperator.prototype .CALL @的WebPack内部:///./node_modules/rxjs/_esm5/operators/mergeMap.js:97:16 \ nObservable.prototype.subscribe@webpack-internal:///./node_modules/rxjs/_esm5/Observable的.js:162:13 \ nMapOperator.prototype.call@webpack-internal:///./node_modules/rxjs/_esm5/operators/map.js:60:16 \ nObservable.prototype.subscribe@webpack-internal:// /./node_modules/rxjs/_esm5/Observable.js:162:13\nMergeMapOperator.prototype.call@webpack-internal:///./node_modules/rxjs/_esm5/operators/mergeMap.js:97:16\nObservable。 prototype.subscribe@webpack-internal:///./node_modules/rxjs/_esm5/Observable.js:162:13 \ nMergeMapOperator.prototype.call@webpack-internal:///./node_modules/rx JS / _esm5 /运营商/ mergeMap.js:97:16 \ nObservable.prototype.subscribe@webpack-internal:///./node_modules/rxjs/_esm5/Observable.js:162:13 \ nMergeMapOperator.prototype.call@webpack -internal:///./node_modules/rxjs/_esm5/operators/mergeMap.js:97:16 \ nObservable.prototype.subscribe@webpack-internal:///./node_modules/rxjs/_esm5/Observable.js:162 :13 \ nMapOperator.prototype.call@webpack-internal:///./node_modules/rxjs/_esm5/operators/map.js:60:16 \ nObservable.prototype.subscribe@webpack-internal:///./node_modules /rxjs/_esm5/Observable.js:162:13\nObservable.prototype.forEach/<@webpack-internal:///./node_modules/rxjs/_esm5/Observable.js:209:28\nZoneAwarePromise@webpack-internal :///./node_modules/zone.js/dist/zone.js:891:29 \ nObservable.prototype.forEach@webpack-internal:///./node_modules/rxjs/_esm5/Observable.js:205:16 \ nRouter.prototype.activateRoutes@webpack-internal:///./node_modules/@angular/router/esm5/router.js:5626:9 \ nRouter.prototype.runNavigate /&LT; @的WebPack内部:///。 / node_modules / @ angul AR /路由器/ esm5 / router.js:5588:13 \ nZoneAwarePromise @的WebPack内部:///./node_modules/zone.js/dist/zone.js:891:29 \ nRouter.prototype.runNavigate@webpack-internal :///./node_modules/@angular/router/esm5/router.js:5519:16 \ nRouter.prototype.executeScheduledNavigation /&LT; @的WebPack内部:///./node_modules/@angular/router/esm5/ router.js:5474:24 \ nZoneDelegate.prototype.invoke@webpack-internal:///./node_modules/zone.js/dist/zone.js:388:17 \ nonInvoke @的WebPack内部:///./ node_modules/@angular/core/esm5/core.js:4976:24 \ nZoneDelegate.prototype.invoke@webpack-internal:///./node_modules/zone.js/dist/zone.js:387:17 \ NZONE。 prototype.run@webpack-internal:///./node_modules/zone.js/dist/zone.js:138:24 \ nscheduleResolveOrReject /&LT; @的WebPack内部:///./node_modules/zone.js/dist /zone.js:872:29\nZoneDelegate.prototype.invokeTask@webpack-internal:///./node_modules/zone.js/dist/zone.js:421:17\nonInvokeTask@webpack-internal:///。 /node_modules/@angular/core/esm5/core.js:4967:24\nZoneDelegate.prototype.invokeTa SK @的WebPack内部:///./node_modules/zone.js/dist/zone.js:420:17 \ nZone.prototype.runTask@webpack-internal:///./node_modules/zone.js/dist/ zone.js:188:28 \ ndrainMicroTaskQueue @的WebPack内部:///./node_modules/zone.js/dist/zone.js:595:25 \ n&#34;
答案 0 :(得分:1)
这通常发生在惰性模块在第一次构建中抛出错误时。 再次创建构建将解决您的问题!!
尝试运行&#34; ng serve&#34;或者&#34; ng serve --aot&#34;再次
答案 1 :(得分:0)
好的,我找到了导致错误的原因。
我正在从指南中输入(不是复制)代码。
我只添加了模块的路径,我忘了在app-routing.module.ts中添加'default'路由
{
path: '',
redirectTo: '',
pathMatch: 'full'
}
路线正在运行,没有错误!