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.
This issue reappeared in version rc0. In a completely new project.
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 E:/DocCenter/va_WorkStation_Benben/vaSites/upgrade-project/node_modules/@angular/platform-browser/node_modules/@angular/core/src/metadata/ng_module.d.ts, resolving symbol NgModule in E:/DocCenter/va_WorkStation_Benben/vaSites/upgrade-project/node_modules/@angular/platform-brows
er/node_modules/@angular/core/src/metadata.d.ts, resolving symbol NgModule in E:/DocCenter/va_WorkStation_Benben/vaSites/upgrade-project/node_modules/@angular/platform-browse
r/node_modules/@angular/core/src/core.d.ts, resolving symbol NgModule in E:/DocCenter/va_WorkStation_Benben/vaSites/upgrade-project/node_modules/@angular/platform-browser/node_modules/@angular/core/index.d.ts, resolving symbol BrowserModule in E:/DocCenter/va_W
orkStation_Benben/vaSites/upgrade-project/node_modules/@angular/platform-browser/src/browser.d.ts, resolving symbol BrowserModule in E:/DocCenter/va_WorkStation_Benben/vaSites/upgrade-project/node_modules/@angular/platform-browser/src/browser.d.ts
@wcxaaa I'm also using RC0, same error.
Error encountered resolving symbol values statically. Calling function 'makeDecorator', function calls are not supported.
@angular/cli: 1.0.0-rc.0 node: 6.9.1 os: darwin x64 @angular/animations: 4.0.0-rc.1 @angular/cli: 1.0.0-rc.0 @angular/common: 4.0.0-rc.1 @angular/compiler: 4.0.0-rc.1 @angular/compiler-cli: 4.0.0-rc.1 @angular/core: 4.0.0-rc.1 @angular/forms: 4.0.0-rc.1 @angular/http: 4.0.0-rc.1 @angular/material: 2.0.0-beta.2 @angular/platform-browser: 4.0.0-rc.1 @angular/platform-browser-dynamic: 4.0.0-rc.1 @angular/platform-server: 4.0.0-rc.1 @angular/router: 4.0.0-rc.1
If I remove the --aot flag from my build process it works.
Changing function reducer as the message suggests works for me, though it's a weird error:
It was not working:
export const SearchResultReducer =
(state: SearchResultState = INITIAL_SEARCH_RESULT_STATE,
action: Action): SearchResultState => {
...};
This is working:
export function SearchResultReducer(state = INITIAL_SEARCH_RESULT_STATE,
action: Action): SearchResultState {
...
}
+1 form me on JWT AUTH
@wcxaaa @0x1ad2 I'm also using RC0, same error.
This error is super strange. I have error upon ng serve in app.module.ts and after I make minor change (e.g. add whitespace or new line) compiler compiles the code successfully. Even if I revert the change the error is still gone...
version: 1.0.0-rc.1
I'm getting this error with ngrx's combineReducers function. An initial compile throws 'Error encountered resolving symbol values statically. Calling function 'combineReducers', function calls are not supported.'
Prompting a recompile by updating a watched .ts file fires off a build that then succeeds w/o error.
@jmcmichael I dealt with basically the same thing yesterday and was able to resolve it, see my comment here: https://github.com/ngrx/store/issues/348#issuecomment-285496328
In short, I created a service that adds the reducers to the store after the module compiles.
@jcroll thanks very much!
I just now returned to note that I solved the issue using a different approach mentioned in this ngrx issue here and implemented in the ngrx/store example app index.ts here.
I'm still wrapping my head around ng2, ngrx/store and TypeScript, so I'm not quite sure if these approaches do basically the same thing. At a first glance, the example-app solution looks like the simpler one, as it just returns a function (which was what the error message I received was complaining about) instead of creating a new injectable service.
We get the same error when serving; As @metodribic described we leave the process running but insert a blank line into app.module.ts to notify webpack to recompile. This results in success and the application is runs and compiles fine from that point. SO v 1.0.0-rc1
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
C:/workspace/ng2/npm-module-test/consumer-app/node_modules/@company/lib-app/node
_modules/@angular/core/src/metadata/ng_module.d.ts, resolving symbol NgModule in
C:/workspace/ng2/npm-module-test/consumer-app/node_modules/@company/lib-app/node_
modules/@angular/core/src/metadata.d.ts, resolving symbol NgModule in C:/workspac
e/ng2/npm-module-test/consumer-app/node_modules/@company/lib-app/node_modules/@an
gular/core/src/core.d.ts, resolving symbol NgModule in C:/workspace/ng2/npm-modul
e-test/consumer-app/node_modules/@company/lib-app/node_modules/@angular/core/inde
x.d.ts, resolving symbol SharedLibraryModule in C:/workspace/ng2/npm-module-test/
consumer-app/node_modules/@company/lib-app/src/app/shared-library/shared-library.
module.ts, resolving symbol SharedLibraryModule in C:/workspace/ng2/npm-module-te
st/consumer-app/node_modules/@company/lib-app/src/app/shared-library/shared-libra
ry.module.ts
Same error using angular-cli 1.0.0-rc.1.
ERROR in Error encountered resolving symbol values statically. Reference to a local (non-exported) symbol 'appRoutes'. Consider exporting the symbol (position 9:7 in the original .ts file), resolving symbol AppRoutingModule in [...]
Is there another issue about this problem? It happens the same error and compiles correctly when I save any file to force the living reload.
Check out this article as it helps clear up some of the confusion with regard to getting your code ready for AOT. Unfortunately it's a necessary evil so the AOT compiler can do it's job and as many are facing, libraries will need to be updated for full support.
Making your Angular 2 library statically analyzable for AoT
Additionally, AOT is on by default, so you can always set the flag --aot false when running ng build if you don't care about it and/or will refactor for AOT support at a later time.
Fun fact, you'll also get errors if you include a component/pipe/directive that isn't part of a module. github issue. Not exactly an assumed behavior but I'm told an expected one.
Good Luck!
I will compare my code with the article and change the necessary.
Thanks a lot @davefedele !
@davefedele my project is quite big, got a few people working on it. Is there a way to check this automatically or semi-automatically?
This article also goes into some detail on the sometimes frustrating interactions between ngrx/store. ngrx/effects, and AOT:
http://orizens.com/wp/topics/guidelines-for-developing-with-angular-ngrxstore-ngrxeffects-aot/
I had the error @tom10271 described with makeDecorator when developing my own library and resolved it thanks to @joidegn's suggestion by moving angular from dependencies to peerDependencies.
I get same error as @christianacca when I try to create the build itself. watching is fine. this is due to
// index.ts
export const COMPONENTS_LIST = {
some_component: mySomeComponent
}
Object.keys(COMPONENTS_LIST).map((component) => { console.log(component); return COMPONENTS_LIST[component] });
I just update for Angular4 but it not cancel issue
ERROR in Error encountered resolving symbol values statically. Reference to a local (non-exported) symbol 'tenantRoutes'. Consider exporting the symbol (position 16:7 in the original .ts file), resolving symbol routing in
I create Lazy loader like this
path: 't', loadChildren: () => new Promise(resolve => {
(require as any).ensure([], function (require: any) {
resolve(require('./tenant/CKW/module')['CKWModule']);
})
})
it can RouterModule.forRoot(tenantRoutes); but use forRoot have issue
Building off of @wcxaaa's response, There IS a way to compile successfully on the first run.
It has everything to with how you are transpiling your typescript.
My solution works for the case where you need to publish angular/typescript package to npm.
You should be using ngc (angular typescript compiler) instead of tsc. It functions as a stand in for tsc with all the same options except a specific few. It references a tsconfig-aot.json instead of tsconfig.json Here are the docs for ngc: https://github.com/angular/angular/blob/0e38bf9de0836c8747851e0998aaca827c8d3c77/aio/content/guide/aot-compiler.md
My build script looks like this $ ./node_modules/.bin/ngc --project src/core/tsconfig-aot.json"
Here is my tsconfig-aot.json
{
"compilerOptions": {
"module": "es2015",
"target": "ES5",
"moduleResolution": "Node",
"declaration": true,
"noImplicitAny": true,
"stripInternal": true,
"skipLibCheck": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"es2016",
"dom"
],
"sourceMap": true,
"outDir": "../../dist",
"typeRoots": [
"node_modules/@types"
],
"types" : ["node"]
},
"exclude": [
"**/*.spec.ts"
],
"angularCompilerOptions": {
"strictMetadataEmit": true,
"genDir": "../../dist"
}
}
The important confgurations here are:
- "module": "es2015" (NOT commonJS)
- "genDir": "../../dist" (will write factories and summaries to directory housing the tsconfig-aot if you don't specify otherwise
Now when I npm publish, pull in the module, then ng serve there are no errors!
I can't build!
When I run /node_modules/.bin/ngc --project src/core/tsconfig-aot.json
It have issue Error: Error encountered resolving symbol values statically. Reference to a local (non-exported) symbol 'tenantRoutes'. Consider exporting the symbol (position 16:7 in the original .ts file), resolving symbol routing
Compilation failed