Chrome extension hint.js & ngHintModules

2019-01-17 09:03发布

问题:

Our angular app sometime does not load on chrome canary (Version 41.0.2237.0 canary (64-bit)) saying

Failed to instantiate module ngHintModules due to: RangeError: Maximum call stack size exceeded

But it loads fine in firefox, chrome (Version 39.0.2171.71 (64-bit)), safari.

Probably not sure whether there is something to do with angular or not.

Full error

Uncaught Error: [$injector:modulerr] Failed to instantiate module ngHintModules due to:
RangeError: Maximum call stack size exceeded
    at Array.forEach (native)
    at module.exports (chrome-extension://ighdmehidhipcmcojjgiloacoafjmpfk/dist/hint.js:2333:21)
    at module.exports (chrome-extension://ighdmehidhipcmcojjgiloacoafjmpfk/dist/hint.js:2384:5)
    at chrome-extension://ighdmehidhipcmcojjgiloacoafjmpfk/dist/hint.js:2387:7
    at Array.forEach (native)
    at module.exports (chrome-extension://ighdmehidhipcmcojjgiloacoafjmpfk/dist/hint.js:2385:21)
    at chrome-extension://ighdmehidhipcmcojjgiloacoafjmpfk/dist/hint.js:2387:7
    at Array.forEach (native)
    at module.exports (chrome-extension://ighdmehidhipcmcojjgiloacoafjmpfk/dist/hint.js:2385:21)
    at chrome-extension://ighdmehidhipcmcojjgiloacoafjmpfk/dist/hint.js:2387:7

NB: The Error I am showing here is from

Version 41.0.2237.0 canary (64-bit)

回答1:

I also had this problem which was resolved by disabling Batarang.



回答2:

This issue is opened on the Batarang Github here: https://github.com/angular/angularjs-batarang/issues/156

You can load the prior version of Batarang from this zip file: https://github.com/angular/angularjs-batarang/archive/v0.4.3.zip

  1. Open More Tools->Extensions in Chrome
  2. Locate AngularJS Batarang and click on the trash can to remove the extension
  3. Download the .zip
  4. Extract the file
  5. Open More Tools->Extensions in Chrome
  6. Check Developer Mode at the top
  7. Click 'Load unpacked extension'
  8. Select the directory where you extracted the zip
  9. If you get an error about the manifest file, then you probably selected one directory level too high. Make sure that you select the bottom level angularjs-batarang-0.4.3 directory
  10. Load up an AngularJS page and use Batarang again with Inspector just like before

This will restore the previous version which while having issues does have some mostly working features like Performance profiling, scope inspector, options, and a help tab which are gone from the latest version. The 0.7.1 version fixes the major breakage of apps, but it only provides the scope tree (no inspector) and the new angular-hint functionality.



回答3:

You don't need to disable Angular batarang; just do the following:

  1. Open the developer tools and navigate to the hint.js file (the one that is triggering the stack overflow)
  2. Go to line 453 add add a breakpoint
  3. reload the app, and when it hits the breakpoint just comment it out (setupModuleLoader(window)) and click continue
  4. It will still throw an exception, (Uncaught ReferenceError: angular is not defined) but you will be able to run batarang

I know it's not the best solution, but that's the quickest thing I could find without going too deep into the problem

Update:

Checking more to what is happening I noticed that the problem happens when we have define multiple modules and we are adding the same dependencies for all of them.

for example:

angular.module("app", ["moduleB", "moduleC"]);
angular.module("moduleB", ["moduleC"]);

When I define the moduleB without passing the same deps with it's parent module, then there is no stack overflow.

angular.module("moduleB", []);


回答4:

Our team just experienced this error and it was fixed by updating the Batarang Extension in Chrome to the latest.



回答5:

Update... With the new update of Chrome, the problem is back, so if anyone experienced this error, revert back to previous build of Chrome. All builds available here, don't pick the first one. http://www.slimjet.com/chrome/google-chrome-old-version.php Then it should work fine!



回答6:

I had the same problem with GitHub pages site (with Jekyll).
Searched for hours why does AngularJS app didn't show up (ng-cloak was never resolved).
Figured out that was Batarang which causing the issue.

Great thanks for @kpg's answer.