Solvedangular cli Getting Error encountered resolving symbol values statically. Calling function 'makeDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol Injectable

OS?

MacOS Sierre

Versions.

angular-cli: 1.0.0-beta.19-3
node: 6.2.2
os: darwin x64

Repro steps.

Getting this error with using Angular CLI

Error encountered resolving symbol values statically. Calling function 'makeDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol Injectable in /Users/mbp06/Repos/multiple-date-picker-a2/node_modules/@angular/core/src/di/metadata.d.ts, resolving symbol OpaqueToken in /Users/mbp06/Repos/multiple-date-picker-a2/node_modules/@angular/core/src/di/opaque_token.d.ts, resolving symbol OpaqueToken in /Users/mbp06/Repos/multiple-date-picker-a2/node_modules/@angular/core/src/di/opaque_token.d.ts
41 Answers

✔️Accepted Answer

Why is this issue closed? Seems that lot of people running in the very same error.
So do I, I exactly get the error:
Error encountered resolving symbol values statically. Calling function 'ɵmakeDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol Injectable in client-app/node_modules/ng2-breadcrumb/node_modules/@angular/core/core.d.ts

Anybody able to help with this?

Other Answers:

Why am I being blindsided? When I run the build with the --dev flag, everything works. Running it with the --prod flag breaks the build. WHY?!?!?! I'm getting really tired of error messages that don't help. If it is in @angular, it shouldn't be my concern. Tell me what in my code is now magically breaking when it was working fine in non-production mode.
Thanks for letting me vent. Onto 12 hours today and I've got to get the production build done with no clue as to why it is breaking before I can break for the day...

Error encountered resolving symbol values statically. Calling function 'makeDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol Injectable in .../node_modules/@angular/core/src/di/metadata.d.ts, resolving symbol OpaqueToken in .../node_modules/@angular/core/src/di/opaque_token.d.ts, resolving symbol OpaqueToken in .../node_modules/@angular/core/src/di/opaque_token.d.ts

or upgrading for older versions where we didn't run this kind of analysis.

@filipesilva What older versions are you referring to here? I'm trying to upgrade from 2.3 to 4.0 and am getting below. Since it doesn't reference any of my own code I have no idea what is causing it. Have the AOT rules changed between 2.3 and 4.0 at all? Thanks

Error encountered resolving symbol values statically. Calling function 'ɵmakeDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol Injectable in /project/node_modules/@angular/core/core.d.ts, resolving symbol ɵf in /project/node_modules/@angular/core/core.d.ts, resolving symbol ɵf in /project/node_modules/@angular/core/core.d.ts

I find it very "Opaque"

same here.
i've fixed that by extracting to a function.
so this:

TranslateModule.forRoot({
      provide: TranslateLoader,
      useFactory: (http: Http) => new TranslateStaticLoader(http, '/assets/i18n', '.json'),
      deps: [Http]
    })

become this:

function httpFactory(http: Http) {
  return new TranslateStaticLoader(http, '/assets/i18n', '.json');
}

TranslateModule.forRoot({
      provide: TranslateLoader,
      useFactory: httpFactory,
      deps: [Http]
    })

but it didn't happen before.
any better fix?

image

More Issues: