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.
@Aides359 It's better to use this approach for dynamic loading modules with AOT: Lazy loading module
// [...]
export const routes: any = [
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
{
[
{
path: 'dashboard',
loadChildren: 'YOUR_PATH/dashboard.module#DashboardModule',
},
// [...]
I get this error because I building the ready to AOT the problem is that AOT doesn't support arrow functions. For more info please check it here https://github.com/rangle/angular-2-aot-sandbox#current-status
Had the same problem and @eronalves answer solved it.
have same problem
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, resolving symbol Injectable in D:/PROJECTS/O4P/node_modules/ng2-socket-
io/node_modules/@angular/core/src/di/metadata.d.ts, resolving symbol OpaqueToken in
D:/PROJECTS/O4P/node_modules/ng2-socket-io/node_modules/@angular/core/src/di/opaque_token.d.ts,
resolving symbol OpaqueToken in D:/PROJECTS/O4P/node_modules/ng2-socket-
io/node_modules/@angular/core/src/di/opaque_token.d.ts
ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in 'D:\PROJECTS\O4P\src'
@ ./src/main.ts 5:0-74
@ multi ./src/main.ts
Related AOT build issue here:
ERROR in Error encountered resolving symbol values statically. Calling function 'NoOpAnim
ationDriver', function calls are not supported. Consider replacing the function or lambda
with a reference to an exported function, resolving symbol AnimationDriver.NOOP in /User
s/maximilianosuster/Development/angular-agentsection/node_modules/@angular/platform-brows
er/src/dom/animation_driver.d.ts, resolving symbol BrowserTestingModule in /Users/maximil
ianosuster/Development/angular-agentsection/node_modules/@angular/platform-browser/testin
g/browser.d.ts, resolving symbol BrowserTestingModule in /Users/maximilianosuster/Develop
ment/angular-agentsection/node_modules/@angular/platform-browser/testing/browser.d.ts
ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/Users/
maximilianosuster/Development/angular-agentsection/src'
@ ./src/main.ts 4:0-74
@ multi ./src/main.ts
➜ angular-agentsection git:(109-renable-unit-tests) ✗
I have seen reports on issues with AOT and NoOpAnimationDriver but previously proposed solutions do not work for me. Anyone has any idea where this error originates?
Fixed by deleting @angular folder at internal node_modules directory of a problematic module (ng2-color-picker in my case).
ERROR in 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 69:19 in the original .ts file), resolving symbol AppModule in app.module.ts
Can any one help me to fix this problem in my code??? this is the error message;
ERROR in 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 69:19 in the original .ts file), resolving symbol AppModule in src/app/app.module.ts webpack: Failed to compile.
@Abrhaley1 you should provide at least some of the corresponding code so we can suggest you modifications. Also I'm sure if you check some of the previous suggestions and solutions in this thread you will find some guidelines and solutions that might solve your problem.
it woooooooooorks ^^ just I add "paths": { "@angular/": ["../node_modules/@angular/"] } in tsconfig and bilth with ng build --prod --aot=false hhh I'm happy <3
What I did to fix this issue was not using lambda in the function I was passing as parameter for useFactory. I used function(){ return new Config() } instead of () => new Config() and it worked.
This issue should be locked for any further discussion because we figure it out, that the issue is current limitations of AOT and that we should follow the guidelines in order to make code AOT compatible. There is bunch of good articles/solutions mentioned in this thread so listing the known solutions on and on is not productive and does not help anyone.
cc: @Oleg1969
@metodribic Why do I have this problem when using ng serve if it's a problem with AoT?
Sorry I ment Angular CLI instead of AOT. But actually all of this problems are related to AOT somehow, since AOT compatible code resolves the issue...
Got the same issue by using 'angular2-notifications' issue.
Strangely Webstorm auto imported this package as from 'angular2-notifications/dist'
I got it solved by setting it it manually to from 'angular2-notifications'
Had an issue with declaring a variable inside of a custom forRoot function I've created
Turned that variable into an exported const, and it solved the issue... for some reason, it doesn't like variable declared inside of the forRoot functions.
It also happens with console.log and other non exported function calls according to #17663
I tried to define routes like the following and came across this error.
export const routes: Routes = ['open', 'closed', 'processing', 'done']
.map(status => ({ path: `${status}/list`, component: ListComponent, data: { status } }));
The following code also raised the same error.
export const routes: Routes = ['open', 'closed', 'processing', 'done']
.map(function(status: string) {
return { path: `${status}/list`, component: ListComponent, data: { status } };
});
I also tried the following code, which results in a different error: ERROR in Cannot read property 'loadChildren' of null.
export function createRoute(status: string) {
return { path: `${status}/list`, component: ListComponent, data: { status } };
}
export const routes: Routes = ['open', 'closed', 'processing', 'done'].map(createRoute);
I ended up using the following code, which works but is disappointing...
export const routes: Routes = [
{ path: 'open/list', component: ListComponent, data: { status: 'open' } },
{ path: 'closed/list', component: ListComponent, data: { status: 'closed' } },
{ path: 'processing/list', component: ListComponent, data: { status: 'processing' } },
{ path: 'done/list', component: ListComponent, data: { status: 'done' }},
];
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.