Skip to content

ERROR in UIRouterModule is not an NgModule #3232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yahyaKacem opened this issue Dec 28, 2016 · 7 comments
Closed

ERROR in UIRouterModule is not an NgModule #3232

yahyaKacem opened this issue Dec 28, 2016 · 7 comments

Comments

@yahyaKacem
Copy link

yahyaKacem commented Dec 28, 2016

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
@christopherthielen
Copy link
Contributor

ui-router-ng2 1.0.0-beta.3 does not yet support AoT compile. We have a PR ui-router/angular#13 which adds AoT support which I'll get to hopefully next week.

Closing this issue in favor of ui-router/angular#13 and ui-router/angular#15

@yahyaKacem
Copy link
Author

yahyaKacem commented Dec 30, 2016

I'm not compiling with the -aot flag that error is from a regular angular-cli compilation, ng serve without the -aot flag.
for AOT that error is expanded:

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 /var/www/tests/testing-ui-router-with-new-cli/src/app/app.module.ts, resolving symbol AppModule in /var/www/tests/testing-ui-router-with-new-cli/src/app/app.module.ts

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/path/to/new-test-project/src'
 @ ./src/main.ts 4:0-74
 @ multi main

ERROR in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
Module not found: Error: Can't resolve '/path/to/new-test-project/src/$$_gendir' in '/path/to/new-test-project/node_modules/@angular/core/src/linker'
 @ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 69:15-36 85:15-102
 @ ./~/@angular/core/src/linker.js
 @ ./~/@angular/core/src/core.js
 @ ./~/@angular/core/index.js
 @ ./src/main.ts
 @ multi main

@mackelito
Copy link

Getting the same error

@brmcerqueira
Copy link

+1

@christopherthielen
Copy link
Contributor

christopherthielen commented Jan 11, 2017

I'm not compiling with the -aot flag that error is from a regular angular-cli compilation, ng serve without the -aot flag.

I see. OK, I'm keeping this issue closed in favor of the one in the ng2 repository: ui-router/angular#15

@miton18
Copy link

miton18 commented Jan 14, 2017

any solution ?

@Sir-J
Copy link

Sir-J commented Mar 31, 2017

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants