ndxbxrme / generator-angular-meteor

106 stars 19 forks source link

WARNING: Tried to load angular more than once #3

Open AhmadEl-Banna opened 9 years ago

AhmadEl-Banna commented 9 years ago

This happens when choose bower support and add package that depends on angular it self this is related to issue #223 on angular-meteor repo

Suggested fix: I think it would be perfect if the generator remove the dependency on mquandalle:bower and generate an independent package with mquandalle:bower in case of the user choose to add bower support, and also add main files of bower to the cleint in package.js

ndxbxrme commented 9 years ago

Cheers Ahmad, I'll look into that this evening

AhmadEl-Banna commented 9 years ago

Thank you very much

ndxbxrme commented 9 years ago

I've implemented a fix in v0.10.0 based on @renato's solution in angular-meteor issue #205. It seems to work a treat. Give it a shot and let me know what you think, then I'll close the issue.

AhmadEl-Banna commented 9 years ago

Good job I will try it out

AhmadEl-Banna commented 9 years ago

Works fine thank you.

johhansantana commented 8 years ago

Hi there, I'm still having this issue, I created a brand new project, then proceed on creating a route, it worked fine, but after I created a second route I get the error:

WARNING: Tried to load angular more than once.
angular.js:12520 Error: [ng:btstrpd] App Already Bootstrapped with this Element 'document'
http://errors.angularjs.org/1.4.8/ng/btstrpd?p0=document
    at http://localhost:3000/packages/angular_angular.js?6d4ee2c049f945acd899d01d101da60606fc5cc8:91:12
    at doBootstrap (http://localhost:3000/packages/angular_angular.js?6d4ee2c049f945acd899d01d101da60606fc5cc8:1680:13)
    at Object.bootstrap (http://localhost:3000/packages/angular_angular.js?6d4ee2c049f945acd899d01d101da60606fc5cc8:1720:12)
    at HTMLDocument.onReady (eval at <anonymous> (http://localhost:3000/packages/jquery.js?1015953f785c9b76503e2ecb391507dce965f357:365:22), <anonymous>:9:11)
    at fire (http://localhost:3000/packages/jquery.js?1015953f785c9b76503e2ecb391507dce965f357:3169:30)
    at Object.self.add [as done] (http://localhost:3000/packages/jquery.js?1015953f785c9b76503e2ecb391507dce965f357:3215:7)
    at jQuery.fn.ready (http://localhost:3000/packages/jquery.js?1015953f785c9b76503e2ecb391507dce965f357:3449:25)
    at eval (eval at <anonymous> (http://localhost:3000/packages/jquery.js?1015953f785c9b76503e2ecb391507dce965f357:365:22), <anonymous>:15:29)
    at eval (eval at <anonymous> (http://localhost:3000/packages/jquery.js?1015953f785c9b76503e2ecb391507dce965f357:365:22), <anonymous>:17:4)
    at eval (native) <div ui-view="" class="ng-scope">

I have the bower.json file like this:

{
  "name": "testingApp",
  "version": "0.0.0",
  "license": "MIT",
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    ".meteor/local/bower",
    "test",
    "tests"
  ],
  "dependencies": {
  },
  "ignoredDependencies": [
    "jquery",
    "angular"
  ],
  "overrides": {
    "angular": {
      "main": [] 
    }
  }
}

but still no fix to the issue.

donedgardo commented 8 years ago

I can confirm this bug too, once I created the meteor-angular app with bower install options 'Yes'. Creating two consecutive routes with angular-meteor:route 'testroute2'; the first one loads well, where the second one comes up with: Tried to load angular twice error.

ndxbxrme commented 8 years ago

I'll look into it

ndxbxrme commented 8 years ago

hey guys, i'm having trouble recreating this issue which version of the generator are you using and which options are you selecting?

johhansantana commented 8 years ago

I was able to fix it by just making "bower": false in .yo-rc.json file

{
  "generator-angular-meteor": {
    "filters": {
      "js": true,
      "html": true,
      "css": true,
      "pagination": true,
      "framework": "bootstrap",
      "bower": false,
      "auth": true
    },
    "appname": "myApp"
  }
}

How do I verify my current generator version?

ndxbxrme commented 8 years ago

that's very interesting. you can find your version by running

npm list -g generator-angular-meteor
ndxbxrme commented 8 years ago

can you give the latest version (0.20.3) a try?