2017-09-11 11 views
1

Angular2 및 Node.js와 함께 ng2-File-Upload 으로 파일 업로드 작업을하고 있지만 프로젝트를 실행하는 중에 Reflect와 관련된 오류가 있습니다. .getOwnMetadata 여기에 표시된 오류입니다 :왜 "TypeError : Reflect.getOwnMetadata가 함수가 아닙니다."

enter image description here

여기 내 systemjs.config.js

(function (global) { 
    System.config({ 
    paths: { 
     // paths serve as alias 
     'npm:': 'node_modules/' 
    }, 
    // map tells the System loader where to look for things 
    map: { 
     // our app is within the app folder 
     app: 'app', 
     // angular bundles 
     '@angular/core': 'npm:@angular/core/bundles/core.umd.js', 
     '@angular/common': 'npm:@angular/common/bundles/common.umd.js', 
     '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js', 
     '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js', 
     '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', 
     '@angular/http': 'npm:@angular/http/bundles/http.umd.js', 
     '@angular/router': 'npm:@angular/router/bundles/router.umd.js', 
     '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js', 
     // other libraries 
     'rxjs':      'npm:rxjs', 
     'angular-in-memory-web-api': 'npm:angular-in-memory-web-api', 
     /** Path for ng2-file-upload */ 
     'ng2-file-upload' : 'npm:ng2-file-upload' 
     /** Path for ng2-file-upload */ 
    }, 
    // packages tells the System loader how to load when no filename and/or no extension 
    packages: { 
     app: { 
     main: './transpiled-js/main.js', 
     defaultExtension: 'js' 
     }, 
     rxjs: { 
     defaultExtension: 'js' 
     }, 
     'angular-in-memory-web-api': { 
     main: './index.js', 
     defaultExtension: 'js' 
     }, 
     /** Configuration for ng2-file-upload */ 
     'ng2-file-upload' : { 
     main: './ng2-file-upload.js', 
     defaultExtension: 'js' 
     } 
     /** Configuration for ng2-file-upload */ 
    } 
    }); 
})(this); 
+0

파일 업로드 관련 코드를 게시하십시오. –

답변

0

나는 똑같은 문제에 직면했을 때 이것은 시나리오 :

2 개의 다른 위치에 같은 이름의 두 개의 TypeScript 파일 (예 : FileUploadService.ts)이 있습니다. 하나는 서버 로직 (server 디렉토리에 있음)을 처리하기위한 것이고, 다른 하나는 Angular 서비스를 통한 파일 업로드를 위해 public 디렉토리에 있습니다.

The problem was that I was importing the wrong service in a location where the ng2-file-upload package was used, which in turn depends on Angular modules - which were never being imported.

Reflect.getOwnMetadata 어딘가에 정의 파일이 타이프 라이터 컴파일하는 동안 사용할 수없는 것을 의미했다.

올바른 위치에 올바른 파일을 참조했는지 확인하십시오.