Angular 4'ng build'错误静态解析符号值

时间:2017-05-14 07:28:24

标签: angular angular-cli semantic-ui

我最近更新了package.json文件中的所有包,如下所示。但是现在在'ng build'期间我得到了这个错误,我不知道如何解决,有没有人有任何想法我将如何解决这个问题?我正在使用在线包中的组件,可以在https://github.com/lon-yang/angular2-semantic-ui

找到
      Package.json:

      {
        "name": "moto-duel",
        "version": "0.0.0",
        "license": "MIT",
        "angular-cli": {},
        "scripts": {
          "start": "ng serve",
          "lint": "tslint \"src/**/*.ts\"",
          "test": "ng test",
          "pree2e": "webdriver-manager update",
          "e2e": "protractor"
        },
        "private": true,
        "dependencies": {
          "@angular/animations": "^4.1.2",
          "@angular/common": "^4.1.2",
          "@angular/compiler": "^4.1.2",
          "@angular/compiler-cli": "^4.1.2",
          "@angular/core": "^4.1.2",
          "@angular/forms": "^4.1.2",
          "@angular/http": "^4.1.2",
          "@angular/platform-browser": "^4.1.2",
          "@angular/platform-browser-dynamic": "^4.1.2",
          "@angular/platform-server": "^4.1.2",
          "@angular/router": "^4.1.2",
          "@types/jasmine": "^2.5.47",
          "angular2-semantic-ui": "^2.0.2",
          "angularfire2": "^4.0.0-rc0",
          "codelyzer": "^3.0.1",
          "core-js": "^2.4.1",
          "firebase": "^3.9.0",
          "jasmine-core": "^2.6.1",
          "jasmine-spec-reporter": "^4.1.0",
          "karma": "^1.7.0",
          "moment": "^2.18.1",
          "moment-timezone": "^0.5.13",
          "protractor": "^5.1.1",
          "rxjs": "^5.4.0",
          "ts-helpers": "^1.1.2",
          "ts-node": "^3.0.4",
          "typescript": "^2.3.2",
          "webdriver-manager": "^12.0.6",
          "zone.js": "^0.8.10"
        },
        "devDependencies": {
          "@angular/cli": "^1.0.3",
          "@angular/compiler-cli": "^4.1.2",
          "@types/jasmine": "^2.5.47",
          "@types/moment-timezone": "^0.2.34",
          "@types/node": "^7.0.18",
          "codelyzer": "^3.0.1",
          "jasmine-core": "^2.6.1",
          "jasmine-spec-reporter": "^4.1.0",
          "karma": "^1.7.0",
          "karma-chrome-launcher": "^2.1.1",
          "karma-cli": "^1.0.1",
          "karma-jasmine": "^1.1.0",
          "karma-remap-istanbul": "^0.6.0",
          "protractor": "^5.1.1",
          "ts-node": "^3.0.4",
          "tslint": "^5.0.0",
          "typescript": "^2.3.2",
          "webdriver-manager": "^12.0.6"
        }
      }

 Module:
      import { NgModule } from '@angular/core';
      import { FormsModule } from '@angular/forms';

      import { CoreModule } from '../core/core.module';
      import { AdminRoutingModule, routedComponents } from './admin-routing.module';
      import { CHECKBOX_DIRECTIVES } from 'angular2-semantic-ui';
      import { DROPDOWN_DIRECTIVES } from 'angular2-semantic-ui';

      @NgModule({ 
        imports: [
          AdminRoutingModule,
          FormsModule,
          CoreModule
        ],
        exports:[
          CHECKBOX_DIRECTIVES,
          DROPDOWN_DIRECTIVES
        ],
        declarations: [
          routedComponents,
          CHECKBOX_DIRECTIVES,
          DROPDOWN_DIRECTIVES
        ]
      })
      export class AdminModule { }

 ERROR in Error encountered resolving symbol values statically. Only
  initialized variables and constants can be referenced because the value 
 of this variable is needed by the template compiler (position 2:22 in the
  original .ts file), resolving symbol CHECKBOX_DIRECTIVES in 
 C:/MotoDuel/node_modules/angular2-semantic-ui/components/checkbox/index.d.ts, 
 resolving symbol CHECKBOX_DIRECTIVES in C:/MotoDuel/node_modules/angular2-
 semantic-ui/index.d.ts, resolving 
 symbol AdminModule in C:/MotoDuel/src/app/admin/admin.module.ts, 
 resolving symbol AdminModule in C:/MotoDuel/src/app/admin/admin.module.ts

先谢谢你们

1 个答案:

答案 0 :(得分:0)

我认为这是一个临时的。通过更改

中的导出来修复它
 node_modules/angular2-semantic-ui/components/checkbox/index.‌​d.ts 

来自:

 export declare const CHECKBOX_DIRECTIVES: Array<any>; 

 export class CHECKBOX_DIRECTIVES{} 

它修复了我的所有问题......我为我目前在项目中使用的每个组件做了这个,这只是复选框和下拉列表。也许这可以在主要回购中更改。

感谢您查看。