Zanecola
Zanecola

Reputation: 1544

Angular2: ERROR in Error encountered resolving symbol values statically

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?

Upvotes: 7

Views: 6515

Answers (3)

TAHA SULTAN TEMURI
TAHA SULTAN TEMURI

Reputation: 5291

I was working with Teams , What I noticed after research that the component was not part of the chain,

NO BLUE LOCK SYMBOL

So first find all folders that has no blue lock symbol (IN CASE YOU USING SOURCE CONTROL) include them and check in those components

The Error was

enter image description here

enter image description here

SOLUTION is to add in source control first then check in

enter image description here

Upvotes: 0

Anant
Anant

Reputation: 153

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

Upvotes: 3

Zanecola
Zanecola

Reputation: 1544

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.

Upvotes: 13

Related Questions