scotch / angular-brunch-seed

AngularJS + Brunch
Other
228 stars 78 forks source link

TypeError: angular undefined #68

Closed gatlin closed 11 years ago

gatlin commented 11 years ago

Pulled from master today using brunch. Installed dependencies using bower and then ran ./scripts/server.sh. In Firefox 20 and Chrome latest, I get the beforementioned TypeError in the console.

I'm a bit new to node / brunch / bower and all the minification going on so I'm in over my head figuring out what's wrong.

kylefinley commented 11 years ago

Hey @gatlin,

Thanks for reporting this. There are a few things that could cause this. Would you be able to put the code on Github, so I can take a look?

xge commented 11 years ago

I'm having the exact same problem. Right after brunch new myapp --skeleton https://github.com/scotch/angular-brunch-seed and bower install and scripts/server.sh I try to start the fresh app and it gives me: Uncaught ReferenceError: angular is not defined in partials.js and app.js

I tried searching for Angular in vendor.js after starting the app and it's not in there. So maybe there's something wrong with copying/concatenating it?

kylefinley commented 11 years ago

@gatlin, @xge,

I was able to reproduce the error -- I'm still working on a fix. In the mean time you should be able to get angular-brunch-seed working by running:

./scripts/init.sh

instead of bower install. ./scripts/init.sh uses bower 0.8.x the issue seems to be with bower 0.9.x.

tolyo commented 11 years ago

Hey @kylefinley

Running init.sh after bower install does not help: none of the angular libs make it into the vendor.js folder. I have been only able to recover my app by copying the /vendor folders from a clean skeleton.

Cheers Toly

tolyo commented 11 years ago

The issue appears to be related to bower's deprecation of component.json. See e.g. https://github.com/angular/bower-angular/commit/d396cfc6daa7442f601110c8e540f3544cb561e9 This is a brunch issue, no?

kylefinley commented 11 years ago

Thanks @tolyo

I just push a change that I think fixes this issue. Could you please test it and let me know if it works for you.

./scripts/init.sh

Thank you,

Kyle

tolyo commented 11 years ago

@kylefinley

Upgraded myself to bower 0.9.2. We good now. Thank you for your fast response.

gatlin commented 11 years ago

Whoa I totally checked out there for a while. I'll test this out soon. Thanks for the prompt and swift attention!

gatlin commented 11 years ago

Today I created a new project thusly:

git clone https://github.com/scotch/angular-brunch-seed.git myapp cd myapp vi bower.json

... added "angular-ui": "*" to the list of dependencies ...

./scripts/init.sh ./scripts/server.sh

Then I took a look at the generated vendor.js and I did not see angular-ui in it. No other code modifications. Mac OS X 10.7, npm 1.2.21, node 0.10.7.

I think this is the crux of the problem.

tolyo commented 11 years ago

Add the route to the .js file in config.coffee. This is my set up:

order:
    before: [
        'vendor/angular-ui/build/angular-ui.js'

and

  bower:
      extend:
          "angular-ui" :  'vendor/angular-ui/build/angular-ui.js'