2017-05-22 1 views
1

나는 다음과 같은 한 오류 유형의 매개 변수에 할당 할 수없는 :인수는 'HTTP를'

[ts] Argument of type 'Http' is not assignable to parameter of type 'Http'. Property '_backend' is protected but type 'Http' is not a class derived from 'Http'. (parameter) http: Http

이 오류는 파일 auth.module.ts에

import { NgModule } from '@angular/core'; 
import { Http, RequestOptions } from '@angular/http'; 

import { AuthHttp, AuthConfig } from 'angular2-jwt' 

import { AuthService } from './auth.service'; 
import { AuthGuard } from './auth.guard'; 
import { RoleGuard } from './role.guard'; 
import { GuestGuard } from './guest.guard'; 

export function authHttpServiceFactory(http: Http, options: RequestOptions) { 
    return new AuthHttp(new AuthConfig(), http, options); 
} 

@NgModule({ 
    providers: [ 
    AuthService, 
    AuthGuard, 
    RoleGuard, 
    GuestGuard, 
    { 
     provide: AuthHttp, 
     useFactory: authHttpServiceFactory, 
     deps: [Http, RequestOptions] 
    } 
    ] 
}) 
export class AuthModule {} 

무엇 인 잘못된?

+0

어떤 각도의 angular2-jwt 버전을 사용하고 있습니까? – jgranstrom

+0

"angular2-jwt": "^ 0.2.0"package.json https://pastebin.com/gYiqMV5m – Defus

+0

코드에 명백한 오류가 보이지 않지만 각도 모듈의 버전을 볼 수 없습니다. 당신이 게시 한 package.json에서. 당신의 각진 모듈은'2.4.2 '이전 버전입니까? – jgranstrom

답변

0

npm link으로 참조되는 라이브러리가 없는지 확인하십시오. issue with linked dependencies이 있습니다.

더 많은 도움을 드리고 싶지만 현재 다른 설정에서 같은 문제로 고심하고 있습니다.