나는 공백 응용 프로그램을 시작했고 Auth0의 CDN에서 스크립트를 포함하거나 원사 사용 대신 npm install
을 사용하기로 Auth0의 setup guide을 시작했습니다. 나는 과거의 1 단계를하지 않습니다 ("설치 프로그램이 응용 프로그램의 코드"헤더에) 내가 ng serve
를 실행할 때 다음과 같은 오류를받지 않고는 :'./auth/auth.service'모듈을 찾을 수 없습니다.
ERROR in /Users/g/Documents/Projects/login/src/app/app.component.ts (2,29): Cannot find module './auth/auth.service'.
ERROR in /Users/g/Documents/Projects/login/src/app/app.component.ts (10,28): Cannot find name 'Authservice'.
내 app.component.ts 코드 (유일한 코드 I입니다) 각도의 빈 설정에서 수정 :
import { Component } from '@angular/core';
import { AuthService } from './auth/auth.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
constructor(public auth: Authservice) {
auth.handleAuthentication();
}
}
은 내가 잘못 여기서 뭐하는 거지? 그 가이드의 첫 번째 단계에서 오류 기회가 많지는 않지만 문제의 일부는 npm install --save auth0-js를 실행하면 "auth"폴더가 내 프로젝트에 저장되지 않는다는 것을 짐작할 수 있습니다. 내 app.component.ts 파일의 두 번째 코드 줄이 "인증"폴더를 참조하려고합니다. 당신이 더 이상 유효하지 셋업 가이드를 사용하는 것처럼
'auth.service.ts'라는 이름의 파일이'auth'라는 폴더 안에 있지 않고'app.component.ts' 파일과 같은 폴더에 있다면, 그 파일은 작동하지 않을 것입니다. – Baruch
설치 단계에서 누락 된 것이 하나 있다고 생각합니다. 앱 모듈에서 "auth0-js"모듈을 가져와야합니다. 이미 수행 한 경우 과 같은 authservice를 사용할 수 있습니다. 'auth0-js'에서 {AuthService}를 가져 오십시오. –
그래서 @AmanArora 어떻게 생겼을까요? 나는'auth0-js '에서'import *를 시도했다;'하지만 동일한 오류가 발생했다. – joevern