Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

192
Views
Error after upgrade to angular 4 ERROR in Cannot use 'in' operator to search for 'providers' in null

After update to angular 4 I always getting the same error during build with angular-cli:

ERROR in Cannot use 'in' operator to search for 'providers' in null 

this is my app.modules.ts:

const authenticatedRoutes: Route[] = [
      {
        path: 'app',
        component: TsComponent,
        children: routingConfig
      },
      { path: '**', redirectTo: 'app/cockpit', pathMatch: 'full' }
    ];

const routes: Route[] = [
  { path: 'login', component: LoginComponent, canActivate: [StartupActivationGuard] }
];

@NgModule({
  declarations: [
    AppComponent,
    LoginComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    GlobalSharedModule.forRoot(),
    TsModule,
    AuthModule.forRoot(),
    StartupModule.forRoot(),
    MaterialModule,
    RouterModule.forRoot(routes)
  ],
  providers: [
    { provide: ErrorHandler , useClass: TimeShepherdExceptionHandler }
  ],
  entryComponents: [AppComponent],
  bootstrap: [AppComponent]
})
export class AppModule {

}


authenticatedRoutes.reduce((routeCollection, route: Route) => {
  route.canActivate = defaultGuards;
  routeCollection.push(route);
  return routeCollection;
}, routes);

const appRouterProviders = RouterModule.forRoot(routes);

And here my app.routes.ts:

const defaultGuards: any[] = [
  AuthActivationGuard
];

const authenticatedRoutes: Route[] = [
  { path: '', redirectTo: 'app/cockpit', pathMatch: 'full' },
  {
    path: 'app',
    component: TsComponent,
    children: routingConfig
  },
  { path: '**', redirectTo: 'app/cockpit', pathMatch: 'full' }
];

const routes: Route[] = [
  { path: 'login', component: LoginComponent, canActivate: [StartupActivationGuard] }
];

authenticatedRoutes.reduce((routeCollection, route: Route) => {
  route.canActivate = defaultGuards;
  routeCollection.push(route);
  return routeCollection;
}, routes);

export const appRouterProviders = RouterModule.forRoot(routes);

I also work with a sub route in another directory ts/ts.routes.ts:

export const routingConfig = [
  { path: 'start', component: StartComponent },
  { path: 'logbook', component: LogBookComponent },
  { path: 'example', component: ExampleComponent },
  { path: 'dev', component: DevComponent },
  { path: 'journal', component: JournalComponent},
  { path: 'cockpit', component: CockpitComponent},
  { path: 'reports', component: ReportsComponent}
];
export const routing = RouterModule.forChild(routingConfig);

Any Idea why I get the error?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!