ng-include causes `Error: only one instance of babel/polyfill is allowed`
Since upgrade to 1.2 and passed ng.html/js to .html/js all my ng-include directive cause this error.
WARNING: Tried to load angular more than once.
Error: only one instance of babel/polyfill is allowed
at Object.eval (eval at <anonymous> (http://localhost:3000/packages/jquery.js?bd30605bc9f8429d01bae2d29081902d10a6c400:373:22), <anonymous>:2963:9)
at Object.2.core-js/shim (eval at <anonymous> (http://localhost:3000/packages/jquery.js?bd30605bc9f8429d01bae2d29081902d10a6c400:373:22), <anonymous>:2966:4)
at s (eval at <anonymous> (http://localhost:3000/packages/jquery.js?bd30605bc9f8429d01bae2d29081902d10a6c400:373:22), <anonymous>:2861:254)
at e (eval at <anonymous> (http://localhost:3000/packages/jquery.js?bd30605bc9f8429d01bae2d29081902d10a6c400:373:22), <anonymous>:2861:425)
at eval (eval at <anonymous> (http://localhost:3000/packages/jquery.js?bd30605bc9f8429d01bae2d29081902d10a6c400:373:22), <anonymous>:2861:443)
at eval (eval at <anonymous> (http://localhost:3000/packages/jquery.js?bd30605bc9f8429d01bae2d29081902d10a6c400:373:22), <anonymous>:7124:4)
at eval (eval at <anonymous> (http://localhost:3000/packages/jquery.js?bd30605bc9f8429d01bae2d29081902d10a6c400:373:22), <anonymous>:7131:3)
at eval (native)
at http://localhost:3000/packages/jquery.js?bd30605bc9f8429d01bae2d29081902d10a6c400:373:22
at Function.jQuery.extend.globalEval (http://localhost:3000/packages/jquery.js?bd30605bc9f8429d01bae2d29081902d10a6c400:374:7) <ng-include src="'client/layout/footer.html'" include-replace="" class="ng-scope">
However the included templates are rendered in the browser. I can't get what is going wrong. I tried the workaround here
Hi @dagatsoin, Usualy all the errors and warning the related to multiple loading of packages is related to the way that Meteor handles 404 pages. If you try to load an HTML that does not exists, you will get 404 and Meteor will give you the main page instead of error.
I think in this case you changed the file names to .html instead of .ng.html and you did not change it in the routes defintion or somewhere else in the code you use the file path.
Can you share your code?
Thanks.
@dagatsoin, I am having the same problem with angular-meteor version 1.2.2. Based on my limited understanding, it seems that two different plugins are trying to load babel/polyfill. I think that one of them is angular-meteor (or one of its dependencies) and the other is ecmascript (or one of its dependencies). I removed the ecmascript package from my project, but it still appears in .meteor/versions because it is apparently still depended on another package, such as the core ddp-server package. I could be completely wrong, but that is my best guess of what our problem is. Unfortunately, I have no idea how to go about solving it.
@canac - can you also share you project's code?
@dotansimha, here you go: https://github.com/canac/meteor-test. Obviously, that is not my real my application, just a stripped down example with just enough code to reproduce the error. Thanks for looking at it!
Thanks @canac.
It is just as I described in my previous comment.
You want to include your file template.html inside your index.html, so you used:
<body ng-app="test" ng-include="'template.html'"></body>
But Meteor compiler saves each template on it's own path, ignoring the index.html location, so the actual code should be:
<body ng-app="test" ng-include="'client/template.html'"></body>
So when you try to load template.html, you actually get 404 which leads to the main page in Meteor so you get the main page included inside the main page... and that's the reason you get the warnings about loading some packages twice.
@dagatsoin, I think this is also relevent to your issue, so please try this solution as well.
@dotansimha, thank you so much for looking at my code. Unfortunately, the change you suggested did not work for me. Did it work for you with my code? I pushed it to the client branch of my repo if you want to check that I made the change that you meant.
By the way, I did not mention this at first, but I am also getting the WARNING: Tried to load angular more than once warning in my developer console. That might be related to this issue. Then again, it might not.
@canac - Yes, the AngularJS warning is related, it also loaded twice because the main page is loaded again.
You can also verify that you use the correct template path by accessing it directly from your browser, for example:
http://localhost:3000/client/template.html
(Check if you get the template.html content or you are being redirected to the main page)
Just git cloneed your project again and it works for me, this is the result:

Please try to meteor reset and then run your project again, also make sure you browser is ignoring cache (http://superuser.com/questions/89809/how-to-force-refresh-without-cache-in-google-chrome).
If this does not work for you, please upload your .meteor/versions and .meteor/packages.
@dotansimha The meteor reset worked for me! Thank you so much for your help! Does running that command solve your problem as well, @dagatsoin?
meteor reset did not work for me. So I clean up the .meteor/packages and manually remove ecmascript and accounts-ui
It works fine now.
@dotansimha I had the same issue, after correcting my routes files I was still receiving the error and warning regarding loading Angular twice...meteor reset worked for me! Thanks so much
I had the same error with my code. And meteor reset is works for me. But I am confused about this. @dotansimha Can you describe it? Thanks.
@JackyXiong - meteor reset just resets your project. It also clears your entire data from the Mongo, so actually I think that meteor rebuild might solve the problem aswell without removing the data.
@dotansimha Thank you.But there is no command named meteor rebuild.In your opinion, is meteor rebuild means meteor build again?
@JackyXiong I meant meteor rebuild, it does not documented in the Meteor docs, be it exists, just try :)
You can find a discussion about this issue here: https://github.com/meteor/meteor/issues/5328
I was also getting similar error after step-7(Folder structure) of the angular-meteor tutorial (http://www.angular-meteor.com/tutorials/socially/angular1/folder-structure) And was fixed after meteor rebuild command.
Indeed it seems appears each time we move a bunch of files into another folder.
If you run meteor rebuild, but still get the error in some page.Check your template path is right again.
And if there is no html content in the template file, this error will appear, too.
I think that in Angular Meteor 1.3 we handle caching better and it does not suppose to happen anymore. Please let me know if that helped
hi everyone... I have a situation where i have some json files for translations. if I keep them in public folder they load perfectly well. where as if i keep them in any other folder in Client then i dont know why the angular-meteor does not recognise the path.
I tried putting the file in Client/MyModule/i18n/en.json and tried giving the urlTemplate as
$translateProvider.useLoader('$translatePartialLoader', { //urlTemplate: '{part}/i18n/{lang}.json' // only works if the file is in public folder urlTemplate: 'client/fuse/toolbar/i18n/en.json' // does not work. });
can anyone help me.
@ansaries if it's still an issue, please open a separate issue for that, thank you