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.
@haisaco If your code isn't properly formatted for ahead of time compilation - you will see errors like this. please see https://medium.com/@isaacplmann/getting-your-angular-2-library-ready-for-aot-90d1347bcad blog post to prepare you logic for aot.
looks like you need to export the variable tenantRoutes on its declaration
it may need to look something like thisexport_ const tenantRoutes: Routes = [ ... ]
I tried but it not working! How about I can set properly formatted for ahead of time compilation? I did read https://medium.com/@isaacplmann/getting-your-angular-2-library-ready-for-aot-90d1347bcad but I understant, what is metadata.json, ngFactory.ts? I see only I use forRoot() it have issue
+1
for angular2-auth
on imports: [ ... AuthModule.forRoot(), ... ],
I got the same issue at angular-router (app-routing.module) using
@angular/cli: local (v1.0.0) node: 7.4.0 os: darwin x64 @angular/animations: 4.0.3 @angular/common: 4.0.3 @angular/compiler: 4.0.3 @angular/core: 4.0.3 @angular/forms: 4.0.3 @angular/http: 4.0.3 @angular/material: 2.0.0-beta.1 @angular/platform-browser: 4.0.3 @angular/platform-browser-dynamic: 4.0.3 @angular/router: 4.0.3 @angular/cli: 1.0.0 @angular/compiler-cli: 4.0.3
error: ERROR in Error encountered resolving symbol values statically. Reference to a local (non-exported) symbol 'routes'.
this error occurs, when I use variables from routing-params.ts inside my app-routing module:
{ component: CatListComponent, path: ''},
{ component: CatListComponent, path: 'cats' },
{ component: CatListComponent, path: `cats/:${ids.cats}` },
{ component: CatDetailComponent, path: `cats/:${ids.cats}/categ1/:${ids.categ1}` },
];```
if I change to the parameters directly which are available under `ids`, the error is gone:
```const routes: Routes = [
{ component: CatListComponent, path: ''},
{ component: CatListComponent, path: 'cats' },
{ component: CatListComponent, path: `cats/:catsUid` },
{ component: CatDetailComponent, path: `cats/:catsUid/categ1/:categ1Uid` },
];`
I'm was also getting this error when trying to create ngrx reducers using a function call:
export const reducer = createReducer();
Since reducers are just functions that pass in state/action, you can still export a function that wraps this constant:
const reducerFn = createReducer();
export function reducer(state, action) {
return reducerFn(state, action);
}
Adds some verbosity, but at least it works with AoT.
I was getting this error when trying to consume a component library that I'm developing locally in an Angular app that I'm also developing locally.
I was using npm link to create a symlink from the app to the component library. I had successfully compiled the library for AOT and was testing it out in the app. I got an error running ng build in the app with a stacktrace that started with:
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 NgModule in /my-angular-app/node_modules/my-
component/node_modules/@angular/core/core.d.ts ...
It turns out that the problem wasn't with my code. The issue is that the symlinked library contained its own node_modules directory. angular-cli was getting confused between the node_modules in the library (which theoretically shouldn't be present in an AOT-compiled library) and the node_modules in the host app.
I changed the name of node_modules in the library to NOT_node_modules and the app compiled perfectly.
Please update to latest version of angular2-perfect-scrollbar #2.0.6
I had the same issue after upgrade to 2.0.6 , Its working for me
https://www.npmjs.com/package/angular2-perfect-scrollbar
Simply resolved by creating a factory like below one (my use case is to have custom HTTP provider hence adjust below code to your needs)
http.factory.ts
import { XHRBackend, RequestOptions } from '@angular/http';
import { CookieService } from 'ng2-cookies';
import { HttpService } from './http.service';
export function HttpFactory(backend: XHRBackend, options: RequestOptions) {
return new HttpService(backend, options);
}
app.module.ts
(...)
providers:
[
{
provide: HttpService,
useFactory: HttpFactory,
deps: [ XHRBackend, RequestOptions ]
}
]
(...)
package.json
(...)
"dependencies": {
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
(...)
Hope it will help someone!
I'm was getting this error on ubuntu14 but it's ok on ubuntu16 i'think my enviroment is broken. so i full install it....
Same error in @angular/cli: 1.0.1
Error still happens in cli version 1.1.0. As others have said, when serving, the first time it will throw an error, but changing a file will make it work for consequent builds. This obviously breaks building your project with aot or prod flag on.
Since this issue was opened and closed several times in the past I think this error is not a bug in the CLI, but for sake of simplicity and debugging it could provide some more information so you would have at least some information where exactly the error occurs (and potentially how to resolve it).
I am building Ionic3 app, I am having this error as in @jeradg error when I try to build/run the app.. I think it because I imported the angular SDK and used some of it's services that are built for the web application (using loopBack)...the folder for the mobile app is also added in the web app. I tried naming the outer node_module for the web app but still didn't work...Im not sure where is the problem.. any suggestion would be helpful ! thanx
@tomaszczechowski Thanks! your solution worked for me!!
Specifying paths to @angular inside AngularCLI’s tsconfig.json solved for me.
“paths”: { “@angular/*“: [“../node_modules/@angular/*“] }
Having the same problem the first time I make a ng serve, then I save a component and all is OK, ¿why?
ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the functi
on or lambda with a reference to an exported function (position 109:9 in the original .ts file), resolving symbol AppModule in
C:/Users/ivan/src/app/app.module.ts
webpack: Failed to compile.
And my app.module.ts pos 109 is:
(backend: XHRBackend, defaultOptions: RequestOptions, router:Router) => {
of the providers:
{
provide: Http,
useFactory:
(backend: XHRBackend, defaultOptions: RequestOptions, router:Router) => {
return new AuthenticationBackendService(backend, defaultOptions, router);
},
deps: [XHRBackend, RequestOptions, Router]
}
@PriNcee11 try to remove the arrow function with export function. Read the AOT guidelines in this article.
still facing the same issue
Error encountered resolving symbol values statically. Calling function 'getStates', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule
./router.ts
export function getStates(){
let states = [];
let loginState: Ng2StateDeclaration = {
name: States.Login,
url: '/login?redirectTo',
component: LoginComponent,
data: {
title: "Login"
}
}
states.push(loginState);
return states;
}
import { getStates } from './router';
@NgModule({
declarations: [
AppComponent,
LoginComponent
],
imports: [
BrowserModule,
UIRouterModule.forRoot({ states: getStates() , useHash: false })
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
I get this error when attempting to npm link to a local module control library
I had this error (also disappearing after triggering recompile) with
// [...]
export const routes: any = [
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
{
[
{
path: 'dashboard',
loadChildren: () => DashboardModule,
},
// [...]
and was able to resolve it by changing it to
// [...]
export function getDashboardModule() { return DashboardModule };
export const routes: any = [
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
{
[
{
path: 'dashboard',
loadChildren: getDashboardModule,
},
// [...]
However this seems to be more of a workaround than a proper solution.