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
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 --versionand 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.
- generate new project with cli beta 24
- npm install angular2-perfect-scrollbar --save
- 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.
Also getting this error, upgrading typescript seems to resolve it (although it might create other errors :/)
angular2-perfect-scrollbar is not publishing metadata, and so is not compatible with Angular CLI. I contacted our relation team and they'll contact that library.
angular2-perfect-scrollbar is just one example , the are plenty modules like that. What you saying all of them will not be compatible with Angular CLI? What that means to us? We can not upgrade because of 3rd party modules simply will stop working. That is kind of odd path. Where would I find information about "publishing metadata" in context with CLI compatibility?
We are working in the future to show a warning for those. I also think it shouldn't be an error, but there are cases where an error can happen because of these libraries (routing for example) and these libraries are not AOT-compatible (at all!).
We have clear guidelines for libraries that include generating those files and what to publish to NPM. If libraries don't follow those guidelines we can't guarantee that they'll be compatible.
And yes, we have report of these a lot, and when I tell the relation team they are actually efficient in dealing with those. So there's hope.
please provide a link to your clear guidelines about publishing compatible library, I'm trying to make one and I'd like it to be compatible.
@hansl I'm having the same problem with Angular-Datatables. is there anything we can do ourselves? or should we always wait for the 3rd party libraries to publish metadata. Where can I find more about the metadata you're talking about?
I have same issue. in beta.22 all work fine. but when I upgrade to beta.24 I got the following error:
ERROR in Error encountered resolving symbol values statically. Calling function 'SharedModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in ../src/app/app.module.ts, resolving symbol AppModule in ../src/app/app.module.ts
I have the same issue with:
angular-cli: 1.0.0-beta.24
node: 7.0.0
os: linux x64
@angular/common: 2.4.2
@angular/compiler: 2.4.2
@angular/core: 2.4.2
@angular/forms: 2.4.2
@angular/http: 2.4.2
@angular/platform-browser: 2.4.2
@angular/platform-browser-dynamic: 2.4.2
@angular/router: 3.4.2
@angular/compiler-cli: 2.4.2
Error:
client?93b6:80Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 12:42 in the original .ts file), resolving symbol compose in /data/2017/search-project/node_modules/@ngrx/core/compose.d.ts, resolving symbol appStore in /data/2017/search-project/src/app/main/app.store.ts, resolving symbol appStore in /data/2017/search-project/src/app/main/app.store.ts, resolving symbol appStore in /data/2017/search-project/src/app/main/app.store.ts, resolving symbol AppModule in /data/2017/search-project/src/app/main/app.module.ts, resolving symbol AppModule in /data/2017/search-project/src/app/main/app.module.ts, resolving symbol AppModule in /data/2017/search-project/src/app/main/app.module.ts
@Bretto That seems to be a missing export error.
I solved it by replace the anonymous (lambda) method to explicitly method:
providers: [
TranslateService,
{
provide: TranslateLoader,
useFactory: translateLoader,
deps: [Http]
}
]
and following method:
export function translateLoader(http: Http) {
return new TranslateStaticLoader(http, 'assets/i18n', '.json');
instead of:
TranslateModule.forRoot({
provide: TranslateLoader,
useFactory: (http: Http) => new TranslateStaticLoader(http, '/assets/i18n', '.json'),
deps: [Http]
})
@baruchvlz the application works, I don't think its a missing export
export const appStore = compose(storeLogger(), combineReducers)({
items: TntReducer.registerReducer(ItemReducers, itemInitState),
});
With the same code other project on previous version of the CLI had no issues...
Currently the application works but when it starts with a big error like this it doesn't look good/pro... I have updated the CLI:
angular-cli: 1.0.0-beta.25.5
node: 7.0.0
os: linux x64
@angular/common: 2.4.3
@angular/compiler: 2.4.3
@angular/core: 2.4.3
@angular/forms: 2.4.3
@angular/http: 2.4.3
@angular/platform-browser: 2.4.3
@angular/platform-browser-dynamic: 2.4.3
@angular/router: 3.4.3
@angular/compiler-cli: 2.4.3
but the problem remains. Is it correct to assume that the issue is in the Ngrx code base ? How do I fix this ?
please provide a link to your clear guidelines about publishing compatible library, I'm trying to make one and I'd like it to be compatible.
@loicsalou I just came across your comment. You can refer to this guide https://medium.com/@cyrilletuzi/how-to-build-and-publish-an-angular-module-7ad19c0b4464#.9y88ipdk7 on how to make a working module.
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 /Users/pathetic-dev/Sites/my-app/public-html/jspm_packages/npm/@angular/[email protected]/src/di/metadata.d.ts, resolving symbol OpaqueToken in /Users/pathetic-dev/Sites/my-app/public-html/jspm_packages/npm/@angular/[email protected]/src/di/opaque_token.d.ts, resolving symbol OpaqueToken in /Users/pathetic-dev/Sites/my-app/public-html/jspm_packages/npm/@angular/[email protected]/src/di/opaque_token.d.ts
at simplifyInContext (/Users/pathetic-dev/Sites/my-app/node_modules/@angular/compiler/bundles/compiler.umd.js:25569:27)
at StaticReflector.simplify (/Users/pathetic-dev/Sites/my-app/node_modules/@angular/compiler/bundles/compiler.umd.js:25581:17)
at StaticReflector.annotations (/Users/pathetic-dev/Sites/my-app/node_modules/@angular/compiler/bundles/compiler.umd.js:25077:64)
at NgModuleResolver.resolve (/Users/pathetic-dev/Sites/my-app/node_modules/@angular/compiler/bundles/compiler.umd.js:17557:86)
at CompileMetadataResolver.getNgModuleMetadata (/Users/pathetic-dev/Sites/my-app/node_modules/@angular/compiler/bundles/compiler.umd.js:18058:64)
at addNgModule (/Users/pathetic-dev/Sites/my-app/node_modules/@angular/compiler/bundles/compiler.umd.js:24839:62)
at /Users/pathetic-dev/Sites/my-app/node_modules/@angular/compiler/bundles/compiler.umd.js:24850:18
at Array.forEach (native)
at _createNgModules (/Users/pathetic-dev/Sites/my-app/node_modules/@angular/compiler/bundles/compiler.umd.js:24849:30)
at analyzeNgModules (/Users/pathetic-dev/Sites/my-app/node_modules/@angular/compiler/bundles/compiler.umd.js:24724:18)
Compilation failed
I start using ng2-cli but why official Angular 2 core library will trigger this error? Very frustrated for switching to AoT after over 1 day of trying....
I had the same issue @tom10271. I think your problem is different than op's. Please check if you have a node_modules folder in ./src folder and if so remove it.
@Bretto I have the same problem. In localhost, it's working even if there is the error. But with Jenkins, the build crash. Any update ?
My Custom Module and the App had different versions of Ng2. After I updated both to the last version of angular the issue disappeared in my case. Hope this helps...
The error even shows up when your using "window." or "location." in your environment file :s Is it incorrect to use window and location in an Angular 2 app?
I am getting the same error, i tried to fix it by converting into an export function: Problem: {provide: APP_INITIALIZER, useFactory: (config: AppConfig) => () => config.load(), deps: [AppConfig], multi: true }, Step1: export function textFunction(config: AppConfig): any { () => { config.load() } }
{provide: APP_INITIALIZER, useFactory: textFunction, deps: [AppConfig], multi: true },
Error: AppInits[i] is not a function
Step2: export function textFunction(config: AppConfig) { return config.load(); } {provide: APP_INITIALIZER, useFactory: textFunction, deps: [AppConfig], multi: true },
Error: AppInits[i] is not a function
When i convert into an export function compiler error gets disappeared but the app breaks with appInits[i] is not a function. Can you please guide me how to convert appIntializer useFactory to an export method.
I get the same error with angular2-cool-storage Linux x64 [email protected] [email protected] [email protected] [email protected] Unfortunately, I see no lambda in imports statement:
import { CoolStorageModule } from 'angular2-cool-storage';
@NgModule({
imports: [CoolStorageModule],
})
export class CoreModule {}
results in:
ERROR in 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,...
I have the same issue when creating translation files using ng-xi18n
Error: Error encountered resolving symbol values statically. Calling function 'NoOpAnimationDriver', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AnimationDriver.NOOP in,..