source

각도 [$injector: modulerr]에러 디버깅 방법

factcode 2023. 2. 17. 21:41
반응형

각도 [$injector: modulerr]에러 디버깅 방법

각도가 점점 커지는 것 같아요.가끔 일을 망쳐서 다음 유형의 오류가 발생합니다.

[$injector:modulerr] Failed to instantiate module App due to:

에러 메시지에 근거해 에러를 검출하는 것은 매우 어려운 경우가 있습니다.특히, 다양한 컨트롤러가 있는 파일이 다수 있는 경우는 더욱 그렇습니다.

Chrome 또는 Firefox에서 이러한 오류를 디버깅하는 방법이 있습니까?

그냥 설명하려고.

이는 Angular의 최소 버전을 로드했을 때 얻을 수 있는 결과입니다.angular.min.js):

Error: $injector:modulerr
Module Error
Failed to instantiate module eduApp due to:
Error: [$injector:modulerr] http://errors.angularjs.org/1.4.7/$injector/modulerr?p0=e...)
    at Error (native)
    at http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:6:416
    at http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:38:184
    at m (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:7:322)
    at h (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:37:275)
    at http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:37:444
    at m (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:7:322)
    at h (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:37:275)
    at fb (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:41:35)
    at d (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:19:463

그리고 이것은 미확정 버전을 사용하면 얻을 수 있는 것입니다.angular.js):

Error: $injector:nomod
Module Unavailable
Module 'ui.bootstrap' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

첫 번째 오류는 해결하기 매우 고통스럽다.두 번째 것이 훨씬 더 쉽다.

해피 코딩!

최소 각도JS에서 읽을 수 없는 오류가 표시됨

... 디버깅을 쉽게 하려면 개발 중에 미확보 버전을 사용하십시오.

나는 다음과 같은 접근법이 어느 정도 도움이 된다는 것을 알았다.로컬 사용angular.js파일을 수정할 수 있습니다.

  1. 를 엽니다.angular.js파일
  2. 다음 코드의 행으로 이동합니다.
    메시지 = 메시지 + '\nhttp://errors.angularjs.org/1.3.5/' +(예: ? 모듈 + '/' : ') + 코드;
  3. 이 두 줄 뒤에 다음 행이 추가됩니다.
    console.log(메시지);

여기서부터 : http://www.chrisgmyr.com/2014/08/debugging-uncaught-error-injectormodulerr-in-angularjs/

언급URL : https://stackoverflow.com/questions/23247444/how-to-debug-angular-injectormodulerr-errors

반응형