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
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?

also re-opened at #3707
I'm getting this error on FlexLayoutModule when trying to run my app.
If I do a dummy edit in some file and hit "ctrl + s" again, it compiles but console dumps out:
FlexLayoutModule.forRoot() has been deprecated and is no longer needed
I'm using Angular v2.4.7 and Angular CLI v1.0.0-beta.31.
I also found some strange things: https://github.com/angular/angular-cli/issues/3674#issuecomment-279977533
Getting the exact same issue with a brand new application I just made now.
When I do
./node_modules/.bin/ng-xi18n -p ./src/tsconfig.json
I get this:
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 exp
ed function, resolving symbol Injectable in D:/Temp/newprj--fe/node_modules/@angular/core/src/di/metadata.d.ts, resolving symbol OpaqueToken in D:/Temp/newprj--fe/node_modules/@angular/core/src
/opaque_token.d.ts, resolving symbol OpaqueToken in D:/Temp/newprj--fe/node_modules/@angular/core/src/di/opaque_token.d.ts
at SyntaxError.BaseError [as constructor] (D:\Temp\newprj--fe\node_modules\@angular\compiler\bundles\compiler.umd.js:1597:31)
at new SyntaxError (D:\Temp\newprj--fe\node_modules\@angular\compiler\bundles\compiler.umd.js:1795:20)
at simplifyInContext (D:\Temp\newprj--fe\node_modules\@angular\compiler\bundles\compiler.umd.js:25783:27)
at StaticReflector.simplify (D:\Temp\newprj--fe\node_modules\@angular\compiler\bundles\compiler.umd.js:25795:17)
at StaticReflector.annotations (D:\Temp\newprj--fe\node_modules\@angular\compiler\bundles\compiler.umd.js:25291:64)
at NgModuleResolver.resolve (D:\Temp\newprj--fe\node_modules\@angular\compiler\bundles\compiler.umd.js:17771:86)
at CompileMetadataResolver.getNgModuleMetadata (D:\Temp\newprj--fe\node_modules\@angular\compiler\bundles\compiler.umd.js:18272:64)
at addNgModule (D:\Temp\newprj--fe\node_modules\@angular\compiler\bundles\compiler.umd.js:25053:62)
at D:\Temp\newprj--fe\node_modules\@angular\compiler\bundles\compiler.umd.js:25064:18
at Array.forEach (native)
Extraction failed
Here's my package.json
"dependencies": {
"@angular/common": "^2.4.8",
"@angular/compiler": "^2.4.8",
"@angular/compiler-cli": "^2.4.8",
"@angular/core": "^2.4.0",
"@angular/forms": "^2.4.8",
"@angular/http": "^2.4.8",
"@angular/platform-browser": "^2.4.8",
"@angular/platform-browser-dynamic": "^2.4.8",
"@angular/router": "^3.4.8",
"angular-cli": "^1.0.0-beta.28.3",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"ng2-bootstrap": "^1.3.3",
"rxjs": "^5.0.1",
"ts-helpers": "^1.1.1",
"zone.js": "^0.7.2"
},
"devDependencies": {
"@angular/cli": "1.0.0-beta.31",
"@angular/compiler-cli": "^2.4.0",
"@types/jasmine": "2.5.38",
"@types/node": "^6.0.42",
"codelyzer": "~2.0.0-beta.1",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-coverage-istanbul-reporter": "^0.2.0",
"protractor": "~5.1.0",
"ts-node": "1.2.1",
"tslint": "^4.3.0",
"typescript": "~2.0.0"
}
I got the following message: ERROR in Error encountered resolving symbol values statically. Calling function 'FlexLayoutModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in C:/(....)/src/app/app.module.ts, resolving symbol AppModule in C:/(....)/src/app/app.module.ts
but application works fine,
This error can also be thrown by referencing modules outside of your project directory. If you have a shared folder that you keep re-usable modules and are referencing modules in that directory through relative references you will get this error, also. Using a symbolic link to the shared directory fixed this issue for me.
Heya, errors like Error encountered resolving symbol values statically mean that there has been some problem in statically analyzing your app.
The CLI always runs statical analysis on code to ensure it will run when compiled with AOT. This may cause a lot of static analysis errors to surface when importing your project into the CLI, or upgrading for older versions where we didn't run this kind of analysis.
A good resource on how to to debug these errors is https://github.com/rangle/angular-2-aot-sandbox#aot-dos-and-donts.
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
I find it very "Opaque"
I believe this to be a bug as well. I get the warning, but once I save a source file the error disappears and the build completes successfully.
I was getting this error just now, but it turned out that the syntax error was in my HTML file. I had a messed up HEAD tag without a proper closing tag. Once I fixed that, the compile happened fine. So look out for errors in HTML too.
@snaikaw same happened to me but when I run ng serve again, the error returned but after some onChange recompilation disappeared with success.
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
@1-0-1 ng build -prod now enables aot by default if I'm not mistaken. You can still use ng build -prod -aot=false.
@filipesilva don't you think that after 6-7 months of the initial release it's time to have an official document on how to get AOT working? I love the work the Rangle.io guys have done and it's super helpful, but it's not complete and still leaves quite a bit of guesswork...
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?
@n4uoase I do believe the Angular team does not consider this a "problem" more like a community challenge...
+1 getting the same error when trying to update from 2.4 to 4.0.
Same with me ... upgarded angular-cli from beta to release ... and problem appearing in one of the angular module ...