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
@Simon-Briggs's solution worked for me also using Angular 4.
"dependencies": {
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"peerDependencies": {
"@angular/common": ">=4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": ">=4.0.0",
etc
I had the same issue with error "ERROR in Error encountered resolving symbol values statically. Calling function ɵmakeDecorator". In my case it was happening when I linked angular-library-seed (that was developed locally) to Angular CLI project via yarn link and then ran ng build --prod to test AOT build. For some reason having node_modules folder in my linked library caused that error.
The following workaround https://github.com/angular/angular-cli/issues/3854#issuecomment-274344771 has saved my day. Specifying paths to @angular inside AngularCLI's tsconfig.json prevented the error from happening.
"paths": { "@angular/*": ["../node_modules/@angular/*"] }
More details here https://github.com/angular/angular-cli/issues/3854#issuecomment-274344771 and here https://github.com/angular/angular-cli/issues/3854#issuecomment-299109237.
Troubleshooting for several days and here is the solution. you save my career. Thanks.
@trekhleb you saved my day too, thanks!
@trekhleb answer is the correct answer... everybody stop looking for it.
In my case what worked out was extract all the provider configuration object to the provider file:
// custom-http.service.ts
@Injectable()
export class CustomHttpService extends Http { ... }
export function customHttpFactory (backend: XHRBackend, defaultOptions: RequestOptions) {
return new CustomHttpService(backend, defaultOptions);
};
export let customHttpProvider = {
provide: CustomHttpService,
useFactory: customHttpFactory,
deps: [ XHRBackend, RequestOptions ]
};
// app.module.ts
import { customHttpProvider } from './shared/services/custom-http/custom-http.service';
@NgModule({
providers: [
customHttpProvider
],
...
}
Don't use a arrow function when exporting the Factory (customHttpFactory in this case), it will fail.
facing below issue when importing function from module as 'RiaCommonsModule.forRoot()'
ERROR in Error encountered resolving symbol values statically. Calling function 'RiaCommonsModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol getRiaCommonsModule in D:/SureCall/Angular-CLI/AnC-Client/src/app/app.module.lib.ts, resolving symbol AppModuleLib in D:/SureCall/Angular-CLI/AnC-Client/src/app/app.module.lib.ts, resolving symbol AppModuleLib in D:/SureCall/Angular-CLI/AnC-Client/src/app/app.module.lib.ts
@trekhleb 's solution did not work for me, unfortunately. I have the exact same error as him, and I don't have any yarn-linked projects (although I have one external project being referenced in a lot of components, but I reference it directly, not via yarn link).
I have specified paths in the tsconfig.json file but I still receive the same error:
Error: Error encountered resolving symbol values statically. Calling function 'makeParamDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol Injectable in /Users/muriloromera/Documents/Git Repos/reserva-de-espacos/Shared/node_modules/@angular/core/src/di/metadata.d.ts, resolving symbol OpaqueToken in /Users/muriloromera/Documents/Git Repos/reserva-de-espacos/Shared/node_modules/@angular/core/src/di/opaque_token.d.ts, resolving symbol OpaqueToken in /Users/muriloromera/Documents/Git Repos/reserva-de-espacos/Shared/node_modules/@angular/core/src/di/opaque_token.d.ts
@trekhleb for me it is working too ... thank you.
Adding "paths": { "@angular/*": ["../node_modules/@angular/*"] }, in tsconfig.json file worked for me too. Thanks @trekhleb.
I followed @Simon-Briggs April 4 suggestion, and in addition removed the dependency's node_modules folder. Working fine now.
@trekhleb 's solution didnt work for me too. I added path in tsconfig.json file but still receive the same error
I've got ng2-translate modul TranslateStaticLoader problem like @webernir. his solution can't fixed my problem, but after I add "export" keyword to his httpFactory function error fixed, like this: ... export function httpFactory(http: Http) { return new TranslateStaticLoader(http, '/assets/i18n', '.json'); } ... hope this helps someone
Thank you for your reply, hey the problem was solved,
I add you on Github k?
2017-08-04 20:19 GMT+07:00 Sukaina Rizvi [email protected]:
Try: npm install --save @angular/cdk
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/4647#issuecomment-320246678, or mute the thread https://github.com/notifications/unsubscribe-auth/AbyrUB_38zBLXyg5rI0U8uOroZJGb6W3ks5sUxpPgaJpZM4L-xjH .
I made this mistake when I created a new project, but tried all the solutions failed, what should I do?
Plus one
@trekhleb for me it is working too :D
Just FYI there's now official troubleshooting guide for this error https://angular.io/guide/metadata#function-calls-are-not-supported.
None of the things listed there helped me.
It turned out the problem was that the library I'm developing didn't specify typings in its package.json.
@trekhleb your solution does not work for me. I am getting following error message when trying to import angular-seed-library into a ionic project.
1: I have tried "paths": { "@angular/": ["../node_modules/@angular/"] } in both tsconfig of angular-seed-library and also in ionic project no solution still the same error. 2: This error appears if I do yarn link and then run ionic-app-scripts build --prod 3: its over a month now since I am struck with this error. I do hope you understand my position here now :( I will really appreciate, if any one can help on this.
LoginComponent is a component that I have made in angular-library-seed at the moment its very simple and basic component.
$ yarn build:aot
yarn build:aot v0.27.5
$ ionic-app-scripts build --prod
[23:38:18] ionic-app-scripts 2.1.4
[23:38:18] build prod started ...
[23:38:18] clean started ...
[23:38:18] clean finished in 1 ms
[23:38:18] copy started ...
[23:38:18] ngc started ...
[23:38:21] ionic-app-script task: "build"
[23:38:21] Error: Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function
(position 756:18 in the original .ts file),
resolving symbol Component in C:/Monsenso-Source/administration/node_modules/@monsenso/
components/node_modules/@angular/core/core.d.ts,
resolving symbol LoginComponent in C:/Monsenso-Source/administration/node_modules/@monsenso/
components/lib/components/login/login.component.d.ts,
resolving symbol LoginComponent in C:/Monsenso-Source/administration/node_modules/@monsenso/
components/lib/components/login/login.component.d.ts
Error: Error encountered resolving symbol values statically. Function calls are not supported. Consider
replacing the function or lambda with a reference to an exported function (position 756:18 in the original
.ts file), resolving symbol Component in
C:/Monsenso-Source/administration/node_modules/@monsenso/components/node_modules/
@angular/core/core.d.ts,
resolving symbol LoginComponent in C:/Monsenso-Source/administration/node_modules/@monsenso/
components/lib/components/login/login.component.d.ts,
resolving symbol LoginComponent in C:/Monsenso-Source/administration/node_modules/@monsenso/
components/lib/components/login/login.component.d.ts
at positionalError (C:\Monsenso-Source\administration\node_modules\@angular\compiler\bundles\
compiler.umd.js:25266:35)
at simplifyInContext (C:\Monsenso-Source\administration\node_modules\@angular\compiler\
bundles\compiler.umd.js:25109:27)
at StaticReflector.simplify (C:\Monsenso-Source\administration\node_modules\@angular\compiler\
bundles\ compiler.umd.js:25123:13)
at StaticReflector.annotations (C:\Monsenso-ource\administration\node_modules\@angular\compiler\
bundles\compiler.umd.js:24553:41)
at NgModuleResolver.resolve (C:\Monsenso-Source\administration\node_modules\@angular\
compiler\ bundles\compiler.umd.js:14891:70)
at CompileMetadataResolver.getNgModuleMetadata (C:\Monsenso-Source\administration\node_modules\@angular\compiler\bundles\compiler.umd.js:15546:60)
at addNgModule (C:\Monsenso-Source\administration\node_modules\@angular\compiler\bundles\compiler.umd.js:24403:58)
at C:\Monsenso-Source\administration\node_modules\@angular\compiler\bundles\compiler.umd.js:24414:14
at Array.forEach (native)
at _createNgModules (C:\Monsenso-Source\administration\node_modules\@angular\compiler\bundles\compiler.umd.js:24413:26)
error Command failed with exit code 1.
wow, I wonder if React developers are dealing with issues like this?