Skip to content

ERROR in UIRouterModule is not an NgModule #3232

Closed
@yahyaKacem

Description

@yahyaKacem

I'm having this error after updating to latest angular-cli 1.0.0-beta.24,
using angular v2.3.1 and angular-cli 1.0.0-beta.21 works but when updating the cli to 1.0.0-beta.24 I get that error in compilation but the app seems to work OK.
Steps to reproduce:
Using latest angular-cli create a new project ng new new-test-project.
then install latest ui-router-ng2 (1.0.0-beta.3).
edit app.module.ts with the import:

import { UIRouterModule } from 'ui-router-ng2';
...
@NgModule({
  providers:    [],
  declarations: [AppComponent],
  bootstrap:    [AppComponent],
  exports:      [UIRouterModule],
  imports:      [
    HttpModule,
    FormsModule,
    BrowserModule,
    UIRouterModule
  ]
})

this will result in the error in the title:

ERROR in UIRouterModule is not an NgModule
using the forRoot like this:

  imports:      [
    HttpModule,
    FormsModule,
    BrowserModule,
    UIRouterModule.forRoot()
  ]

the error changes to this:

ERROR in Error encountered resolving symbol values statically. Calling function 'UIRouterModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in /path/to/new-test-project/src/app/app.module.ts, resolving symbol AppModule in /path/to/new-test-project/src/app/app.module.ts
in both cases the app is compiled with that error and the error also thrown in browser but the app seems to work.

$ ng version
angular-cli: 1.0.0-beta.24
node: 7.3.0
os: linux x64
@angular/common: 2.4.1
@angular/compiler: 2.4.1
@angular/core: 2.4.1
@angular/forms: 2.4.1
@angular/http: 2.4.1
@angular/platform-browser: 2.4.1
@angular/platform-browser-dynamic: 2.4.1
@angular/router: 3.4.1
@angular/compiler-cli: 2.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions