“Unknown provider: aProvider <- a” How do I find the original provider?

后端 未结 9 661
自闭症患者
自闭症患者 2020-12-07 08:46

When I\'m loading the minified (through UglifyJS) version of my AngularJS application, I get the following error in the console:

Unknown provider: aProvider          


        
9条回答
  •  Happy的楠姐
    2020-12-07 09:35

    I just had the same problem and resolved it by simply replacing ngmin (now deprecated) with ng-annotate for my grunt build task.

    It seems that yeoman angular has also been updated to use ng-annotate as of this commit: https://github.com/yeoman/generator-angular/commit/3eea4cbeb010eeaaf797c17604b4a3ab5371eccb

    However if you are using an older version of yeoman angular like me, just replace ng-min with ng-annotate in your package.json:

    -    "grunt-ngmin": "^0.0.3",
    +    "grunt-ng-annotate": "^0.3.0",
    

    run npm install (then optionally npm prune), and follow the changes in the commit to edit Gruntfile.js.

提交回复
热议问题