WARNING: Tried to load angular more than once. Angular JS

后端 未结 23 1490
有刺的猬
有刺的猬 2020-12-01 13:57

I am trying to view my app after running Grunt Build. I use grunt serve:dist to see all production ready build but in the browser I get an infinite loop saying:

23条回答
  •  鱼传尺愫
    2020-12-01 14:23

    I ran into this issue and found that the problem occurred in my karma.conf.js file.

    When specifying which file patterns to load into the browser, I used a wild card identifier to load AngularJS like so:

    'path_to_angular/angular/*.js
    

    If there's more than one file loading AngularJS within that directory, like angular.js and angular.min.js for example, then this error will be thrown.

    To avoid this error, simply specify a single path with no wildcards.

    'path_to_angular/angular/angular.js'
    

    or

    'path_to_angular/angular/angular.min.js'
    

    should do the trick.

提交回复
热议问题