2016-10-13 2 views
2

그래프에 ng2-nvd3 모듈을 사용하고 있습니다. 아래는 제가 오류가 아래에 무엇입니까 코드ionic2 'AppModule'모듈에서 예기치 않은 'nvD3'값이 선언되었습니다.

각 2, 이온 2

import {nvD3} from "ng2-nvd3/build/lib/ng2-nvd3"; 
@NgModule({ 
    declarations: [ 
     nvD3, 
... 
}) 

입니다. 사람이 여기, 내가 같은 오류가 발생한

[15:51:10] lint finished in 1.04 s 
[15:51:11] ngc: Error: Unexpected value 'nvD3' declared by the module 'AppModule' 
    at /Users/…/node_modules/@angular/compiler/bundles/compiler.umd.js:14044:33 
    at Array.forEach (native) 
    at CompileMetadataResolver.getNgModuleMetadata (/Users/…/node_modules/@angular/compiler/bundles/compiler.umd.js:14031:51) 
    at /Users/..//node_modules/@angular/compiler/bundles/compiler.umd.js:12801:47 
    at Array.forEach (native) 
    at analyzeModules (/Users/…/node_modules/@angular/compiler/bundles/compiler.umd.js:12800:17) 
    at OfflineCompiler.analyzeModules (/Users/…/node_modules/@angular/compiler/bundles/compiler.umd.js:12826:18) 
    at CodeGenerator.codegen (/Users/…/node_modules/@angular/compiler-cli/src/codegen.js:105:47) 
    at codegen (/Users/…/node_modules/@angular/compiler-cli/src/main.js:7:81) 
    at Object.main (/Users/..//node_modules/@angular/tsc-wrapped/src/main.js:30:16) 
+0

같은 문제가 발생했습니다. 이 문제를 해결할 수 있을까요? 감사합니다 – Martin

답변

0

오류 아래 해결하는 데 도움 수있는 것은 내가 내 코드에 고정하는 방법입니다

... 
import { Key } from "../../utils/key"; 

declare var setLanguage; //Makes sure this forcing of type (a hack) is here 

@Component({ 
    selector: "page-home", 
    templateUrl: "home.html", 
    providers: [Storage] 
}) 

//declare var setLanguage; //NOT HERE 

export class HomePage { 
... 
+0

이것은 어떻게 OP 문제를 해결합니까? – Martin

+1

다른 소스 파일의 코드로 인해 문제가 발생했을 수 있습니다. 코드에서 위의 버그로 인해 동일한 오류가 발생합니다. 그것은 아마도 그의 문제는 아니지만 다른 사람들을 도울 수 있습니다. – tezcan

0

잘못된

import {nvD3} from "ng2-nvd3/build/lib/ng2-nvd3"; 

오른쪽

import { nvD3 } from 'ng2-nvd3';