2017-09-23 1 views
3

내 프로젝트에 angular2-recaptcha가 설치되었습니다 (https://github.com/xmaestro/angular2-recaptcha).잡히지 않은 ReferenceError : 시스템이 각도가 정의되지 않았습니다. 4

내가 systemjs.config.js 추가 한

:

System.config({ 
    map: { 
    'angular2-recaptcha': 'node_modules/angular2-recaptcha' 
    }, 
    packages: { 
    app: { 
     format: 'register', 
     defaultExtension: 'js' 
    }, 
    'angular2-recaptcha': {defaultExtension: 'js', main:'index'} 
    } 
}); 

index.html을 :

<script src="systemjs.config.js"></script> 
<script> 
System.import('app').catch(function(err){ 
    console.error(err); 
}); 
</script> 

하지만 브라우저 콘솔에서이 오류가 무엇입니까 :

Uncaught ReferenceError: System is not defined 
    at localhost/:29 
compiler.es5.js:15996 Uncaught Error: Unexpected module 'ReCaptchaModule' declared by the module 'AppModule'. Please add a @Pipe/@Directive/@Component annotation. 
    at syntaxError (compiler.es5.js:1690) 
    at compiler.es5.js:15430 
    at Array.forEach (<anonymous>) 
    at CompileMetadataResolver.webpackJsonp.../../../compiler/@angular/compiler.es5.js.CompileMetadataResolver.getNgModuleMetadata (compiler.es5.js:15412) 
    at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler._loadModules (compiler.es5.js:26795) 
    at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler._compileModuleAndComponents (compiler.es5.js:26768) 
    at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler.compileModuleAsync (compiler.es5.js:26697) 
    at PlatformRef_.webpackJsonp.../../../core/@angular/core.es5.js.PlatformRef_._bootstrapModuleWithZone (core.es5.js:4536) 
    at PlatformRef_.webpackJsonp.../../../core/@angular/core.es5.js.PlatformRef_.bootstrapModule (core.es5.js:4522) 
    at Object.../../../../../src/main.ts (main.ts:11) 

도와주세요! 내 실수는 어디 갔지?

<script src="systemjs/dist/system.js"></script> <--------------------- 
<script src="systemjs.config.js"></script> 
<script> 
    System.import('app').catch(function(err){ console.error(err); }); 
</script> 

또한, System 사용이되지 않습니다, 예를 들어 System가 전역 객체가 예상된다 SystemJS, 대신 System.import 사용 SystemJS.import를 사용

답변

1

당신은뿐만 아니라 설정, SystemJS 라이브러리를로드해야합니다.

관련 문제