导致ReferanceError:Angular 4中未定义文档

时间:2017-12-14 06:33:23

标签: angular

当我尝试使用显示此错误的npm start来运行我的项目时

ERROR { ReferenceError: document is not defined
        at DefaultDomRenderer2.selectRootElement (project\node_modules\@angular\platform-browser\bundles\platform-browser.umd.js:2822:72)        
        at Object.createProdRootView [as createRootView] (project\node_modules\@angular\core\bundles\core.umd.js:12827:12)
        at ComponentFactory_.create (project\node_modules\@angular\core\bundles\core.umd.js:9904:46)       
      __zone_symbol__currentTask:
       ZoneTask {
         _zone:
          Zone {
            _properties: [Object],
            _parent: [Object],
            _name: 'angular',
            _zoneDelegate: [Object] },
         runCount: 0,
         _zoneDelegates: null,
         _state: 'notScheduled',
         type: 'microTask',
         source: 'Promise.then',
         data: undefined,
         scheduleFn: undefined,
         cancelFn: null,
         callback: [Function],
         invoke: [Function] } }

但是当我尝试安装ng服务时,它正在工作......

@NgModule({
  declarations: [
    AppComponent,
    NavBarComponent,
    MapViewComponent,
    SomeOtherComponent,
    NoPageComponent,
    MapDetailViewComponent,
    LandingPageComponent,
    LoadingApiComponent,
    DirectionsMapDirective,
    DirectionComponent,
    AuthComponent,
    ProfileComponent
  ],
  imports: [
    BrowserModule.withServerTransition({appId: 'wheelskeep-seo-pre'}),
    RouterModule.forRoot(appRoutes),
    HttpModule,
    FormsModule,
    ReactiveFormsModule,
    InfiniteScrollModule,
    AgmSnazzyInfoWindowModule,
    HttpClientModule,
    AgmCoreModule.forRoot({
      apiKey: 'AIzaSyCYcMhCxFymvxOjYVXyjd9qAFX3I_rnw88'
    }),
    AngularFireModule.initializeApp(environment.firebase),
    AngularFireAuthModule,
    SocialLoginModule,
    BrowserAnimationsModule,
  ],
  providers: [
    ParkService,
    RegisterService,
    {
    provide: AuthServiceConfig,
    useFactory: provideConfig
    }
  ],
  bootstrap: [AppComponent]
})

0 个答案:

没有答案