taptapship / wiredep

Wire Bower dependencies to your source code.
MIT License
1.15k stars 142 forks source link

Odd issue with findComponentConfigFile #215

Closed dainbrump closed 9 years ago

dainbrump commented 9 years ago

Wiredep fails to inject some bower resources because, for some unknown reason, the maintainers of these libraries are leaving the bower.json file empty. This causes a failure in findComponentConfigFile because the file exists, but there is no data for that function to parse. An example is angular-resource 1.4.7.

Since all bower installs have a '.bower.json' file and those are (to the best of my knowledge and exploration thus far) populated with the same data that SHOULD be in a bower.json file, would it not make sense to parse those first? Example, in wiredep 1.8.6, detect-dependencies.js, line 65 change

['bower.json', '.bower.json', 'component.json', 'package.json']

to

['.bower.json', 'bower.json', 'component.json', 'package.json']

Or would it make more sense to just complain to the Angular folks for being bad at bower?

stephenplusplus commented 9 years ago

The angular-resource repo is showing it is correctly defined: https://github.com/angular/bower-angular-resource/tree/v1.4.7, and I just tried bower install angular-resource and confirmed it works as well:

> cat bower_components/angular-resource/bower.json
{
  "name": "angular-resource",
  "version": "1.4.7",
  "main": "./angular-resource.js",
  "ignore": [],
  "dependencies": {
    "angular": "1.4.7"
  }

Maybe something weird is going on with bower?

dainbrump commented 9 years ago

Possibly an odd bower thing. I'm using angular-fullstack and it completes the npm and bower installs, but for some reason a few of the bower packages had empty bower.json files. I'm going to try again and see what happens. Thanks.

dainbrump commented 9 years ago

Just for posterity's sake, the issue was with bower. The solution was "bower cache clean", remove the offending directories from the bower_components dir and then "bower install" to reinstall the packages.