angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ERROR in Error encountered resolving symbol values statically. Expression form not supported

Open jjorbas opened this issue 9 years ago • 5 comments

ng serve -> works fine

ng build --prod --aot=false -> works fine

ng -build --prod -> fails with

ERROR in Error encountered resolving symbol values statically. Expression form not supported (position 12:36 in the original .ts file), resolving symbol HourControlComponent in hour-control.component.ts

My package

"dependencies": { "@angular/cli": "1.0.0", "@angular/animations": "^4.0.1", "@angular/common": "^4.0.1", "@angular/compiler": "^4.0.1", "@angular/compiler-cli": "^4.0.1", "@angular/core": "^4.0.1", "@angular/forms": "^4.0.1", "@angular/http": "^4.0.1", "@angular/material": "2.0.0-alpha.9-3", "@angular/platform-browser": "^4.0.1", "@angular/platform-browser-dynamic": "^4.0.1", "@angular/platform-server": "^4.0.1", "@angular/router": "^4.0.1", "angular2-jwt": "0.1.28", "core-js": "2.4.1", "moment": "2.17.1", "rxjs": "^5.2.0", "ts-helpers": "1.1.1", "typescript": "^2.2.2", "zone.js": "^0.8.5" }, "devDependencies": { "@types/hammerjs": "2.0.33", "@types/jasmine": "2.2.30", "codelyzer": "~0.0.26", "jasmine-core": "2.4.1", "jasmine-spec-reporter": "2.5.0", "karma": "1.2.0", "karma-chrome-launcher": "2.0.0", "karma-cli": "1.0.1", "karma-jasmine": "1.0.2", "karma-remap-istanbul": "0.2.1", "protractor": "4.0.9", "ts-node": "1.2.1", "tslint": "3.13.0" }

My code

import { BaseDataService, ProjectsService, ProposalsService } from '../services/projects-proposals-service/projects-proposals.service';

@Component({ templateUrl: './hour-control.component.html', styleUrls: ['./hour-control.component.css'] }) export class HourControlComponent implements OnInit { public projectList = [];

constructor(private baseService: ProjectsService | ProposalsService) { } ...

The bold line is where the compiler fails.

Can someone help me?

jjorbas avatar Apr 10 '17 12:04 jjorbas

Got the same at /node_modules/.bin/xi18n

glebmachine avatar Apr 18 '17 13:04 glebmachine

At least I solve it removing BaseDataService from all imports and export all service classes

export class BaseDataService {...

jjorbas avatar Apr 18 '17 15:04 jjorbas

I have a problem, please look at this issue : http://stackoverflow.com/questions/43558082/error-in-error-encountered-resolving-symbol-values-statically-reference-to-a-lo

nimatrazmjo avatar Apr 22 '17 11:04 nimatrazmjo

Heya, errors like Error encountered resolving symbol values statically mean that there has been some problem in statically analyzing your app.

The CLI always runs statical analysis on code to ensure it will run when compiled with AOT. This may cause a lot of static analysis errors to surface when importing your project into the CLI, or upgrading for older versions where we didn't run this kind of analysis.

Good resource on how to to debug these errors are https://gist.github.com/chuckjaz/65dcc2fd5f4f5463e492ed0cb93bca60 and https://github.com/rangle/angular-2-aot-sandbox#aot-dos-and-donts.

filipesilva avatar May 04 '17 14:05 filipesilva

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.