I am using angular/cli 1.3.2 and Angular 4.4.0.
When I use an npm module [email protected]
,during compilation I met
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 194:50 in the original .ts file), resolving symbol NgModule in path-to-project/node_modules/angular-split/node_modules/@angular/core/core.d.ts, resolving symbol AngularSplitModule in path-to-project/node_modules/angular-split/dist/angularSplit.module.d.ts, resolving symbol AngularSplitModule in path-to-project/node_modules/angular-split/dist/angularSplit.module.d.ts
Here in file angularSplit.module.d.ts
there is only one line of code:
export declare class AngularSplitModule {}
However, this error can be "resolved" by saving any file and trigger the recompile (weird).
Then, when I open localhost:4200
in the browser I will see another error:
compiler.es5.js:1694 Uncaught Error: Unexpected value 'AngularSplitModule' imported by the module 'AppModule'. Please add a @NgModule annotation.
From github and stackoverflow I found some similar problems but no one could tell the reason.
This happened after I updated node/angular/angular-cli, but after I roll back it still didn't work.
Does anyone know why this happened?
Alright, after hours of reading I found one useful solution here https://github.com/angular/angular-cli/issues/3854#issuecomment-274344771
to be specific, add
paths: { "@angular/*": ["../node_modules/@angular/*"] }
to tsconfig.json
file, "compilerOptions"
option
It solves my problem but still wanna know why.
I have also encountered the below error:
ERROR in solving symbol values statically. Expression form not supported (position 30:19 in the original .ts file), resolving symbol AppModule in /.../src/app/app.module.ts
In app.module.ts, the code was not formatted properly:
Earlier:
@NgModule({
declarations: [
AppComponent,
HomeComponent,,
]
Corrected it to:
@NgModule({
declarations: [
AppComponent,
HomeComponent
]
And it worked. Might be useful for anyone. Thanks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With