angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ERROR in Error encountered resolving symbol values statically. Calling function 'PerfectScrollbarModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function

Open Oleg1969 opened this issue 9 years ago • 98 comments

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) Mac OSX

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here: cli beta 24

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

  1. generate new project with cli beta 24
  2. npm install angular2-perfect-scrollbar --save
  3. import PerfectScrollbarModule.forRoot({suppressScrollX: true})

The log given by the failure.

Normally this include a stack trace and some more information.

ERROR in Error encountered resolving symbol values statically. Calling function 'PerfectScrollbarModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in /.../app.module.ts, resolving symbol AppModule in /..../src/app/app.module.ts

Mention any other details that might be useful.

angular version 2.3.1


Thanks! We'll be in touch soon.

Oleg1969 avatar Dec 22 '16 16:12 Oleg1969

Same issue trying to use angular2-jwt (Json web tokens)

import { AUTH_PROVIDERS } from 'angular2-jwt';

image

Klerith avatar Feb 03 '17 16:02 Klerith

Same issue trying to use angular2-social-login

import { Angular2SocialLoginModule } from "angular2-social-login";

@NgModule({ .... Angular2SocialLoginModule.initWithProviders(providers) });

Error encountered resolving symbol values statically. Calling function 'Angular2SocialLoginModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in '../app.module.ts', resolving symbol AppModule in '../app.module.ts'

apapatp avatar Feb 03 '17 21:02 apapatp

what's exactly happening here?

cesarvarela avatar Feb 04 '17 07:02 cesarvarela

Ok I am back, now I have the same problem with new version 30 of the CLI

Bretto avatar Feb 07 '17 09:02 Bretto

I have an example repo that show cases the problem.

"Interestingly" the problem just got worse after the upgrade to beta 30 of the cli - the site will no longer serve the bundled JS (see screenshot below).

With earlier version of the cli (1.0.0-beta.24), at least the bundled files would be served and the site would be functional.

To reproduce:

  1. Clone the repo: https://github.com/christianacca/ng2-experiements.git
  2. npm install
  3. npm start
  4. browse to http://localhost:4200/

image

christianacca avatar Feb 07 '17 09:02 christianacca

+1

GuillaumeUnice avatar Feb 07 '17 18:02 GuillaumeUnice

Same here too! A problem with angular2-jwt

toanxyz avatar Feb 07 '17 18:02 toanxyz

I'm using @angular/cli beta30, and I have the same issue with ngx-translate. Similar error appears at the first time running ng serve, but compilation is successful after I just press Ctrl + S to a file again without changing anything, even so the translation works fine. Could be a bug of @angular/cli?

valorad avatar Feb 12 '17 03:02 valorad

I have the same problem, and when it re-compiles it goes away. How could this issue be closes ?

@NgModule({
  providers: [
    {
      provide: APP_INITIALIZER,
      useFactory: test2,
      deps: [MainConfigService],
      multi: true
    },
  ],...

export function test2(mainConfigService: MainConfigService) {
  return function test() {
    return mainConfigService.loadConf()
  }
}

Bretto avatar Feb 12 '17 08:02 Bretto

This issue should not be closed as the error continues

xtianus79 avatar Feb 13 '17 04:02 xtianus79

I have the same problem with the FlexLayoutModule. Can't live with it and can't live without it.

nikhildev avatar Feb 13 '17 08:02 nikhildev

Even I am seeing the same error, re compiling the app would make this error disappear.

jeevanpalakurty avatar Feb 13 '17 16:02 jeevanpalakurty

Removing the .forRoot() on FlexLayoutModule fixed the problem

nikhildev avatar Feb 13 '17 16:02 nikhildev

I confirm the same about FlexLayoutModule, remove .forRoot(). Thanks @nikhildev

aguarino77 avatar Feb 14 '17 14:02 aguarino77

More regarding this: https://github.com/angular/angular-cli/issues/3674#issuecomment-279977533

marioleed avatar Feb 15 '17 11:02 marioleed

@christianacca I've tried your app and I found something curious. Once you execute ng serve compilation it will fail, but if you do ctrol+s in any of your files, recompilation will trigger again and, boom, it will work. Why is this happening?? Honestly, I don't have any clue yet. We'll have to dig into it.

robertohuertasm avatar Feb 16 '17 13:02 robertohuertasm

It is strange agreed!

@wcxaaa commented above - he is getting the same problem. See: https://github.com/angular/angular-cli/issues/3707#issuecomment-279194758)

christianacca avatar Feb 16 '17 14:02 christianacca

@robertohuertasm, good luck btw with your digging :-)

christianacca avatar Feb 16 '17 15:02 christianacca

@christianacca you're right. I totally missed @wcxaaa's post! Sorry for the redundancy!

robertohuertasm avatar Feb 16 '17 15:02 robertohuertasm

I've update @angular/cli to last version (actual in beta.32) and @angular/** (common, compiler, core, forms, http, ...) to last version (actual 2.4.8) and resolve this issue.

marciojustino avatar Feb 24 '17 14:02 marciojustino