grunt-bower-task icon indicating copy to clipboard operation
grunt-bower-task copied to clipboard

Breaks for nested bower directories

Open melcher opened this issue 11 years ago • 5 comments

My .bowerrc had "directory": "client/components". Running grunt bower with a default configuration failed because it was unable to find the source files. It was looking for source files at ~project/components, but should have been looking at ~project/client/components. Somehow the parent directory was getting stripped from the path. Setting bower installation "directory": "components" resolved the issue, but figured I'd file a bug.

└─┬ [email protected] └── [email protected]

Here's the stacktrace if it's helpful:

$ grunt bower
Running "bower:install" (bower) task
>> Installed bower packages

/Users/graham/src/hint/mothership/node_modules/grunt-bower-task/node_modules/bower/node_modules/tmp/lib/tmp.js:261
  throw err;
        ^
Error: ENOENT, no such file or directory 'components/angular-mocks/angular-mocks.js'
    at Object.fs.statSync (fs.js:684:18)
    at null.<anonymous> (/Users/graham/src/hint/mothership/node_modules/grunt-bower-task/tasks/lib/asset_copier.js:41:23)
    at /Users/graham/src/hint/mothership/node_modules/grunt-bower-task/node_modules/lodash/lodash.js:601:21
    at Function.eval (eval at createIterator (/Users/graham/src/hint/mothership/node_modules/grunt-bower-task/node_modules/lodash/lodash.js:645:19), <anonymous>:10:9)
    at lodash.(anonymous function) [as each] (/Users/graham/src/hint/mothership/node_modules/grunt-bower-task/node_modules/lodash/lodash.js:3642:27)
    at null.<anonymous> (/Users/graham/src/hint/mothership/node_modules/grunt-bower-task/tasks/lib/asset_copier.js:38:16)
    at /Users/graham/src/hint/mothership/node_modules/grunt-bower-task/node_modules/lodash/lodash.js:601:21
    at Function.eval (eval at createIterator (/Users/graham/src/hint/mothership/node_modules/grunt-bower-task/node_modules/lodash/lodash.js:645:19), <anonymous>:25:9)
    at lodash.(anonymous function) [as each] (/Users/graham/src/hint/mothership/node_modules/grunt-bower-task/node_modules/lodash/lodash.js:3642:27)
    at Copier.copyAssets (/Users/graham/src/hint/mothership/node_modules/grunt-bower-task/tasks/lib/asset_copier.js:37:13)
    at null.<anonymous> (/Users/graham/src/hint/mothership/node_modules/grunt-bower-task/tasks/lib/asset_copier.js:21:12)
    at /Users/graham/src/hint/mothership/node_modules/grunt-bower-task/node_modules/lodash/lodash.js:601:21
    at Function.eval (eval at createIterator (/Users/graham/src/hint/mothership/node_modules/grunt-bower-task/node_modules/lodash/lodash.js:645:19), <anonymous>:25:9)
    at lodash.(anonymous function) [as each] (/Users/graham/src/hint/mothership/node_modules/grunt-bower-task/node_modules/lodash/lodash.js:3642:27)
    at Copier.copy (/Users/graham/src/hint/mothership/node_modules/grunt-bower-task/tasks/lib/asset_copier.js:19:18)
    at null.<anonymous> (/Users/graham/src/hint/mothership/node_modules/grunt-bower-task/tasks/bower_task.js:52:14)
    at EventEmitter.emit (events.js:95:17)
...

melcher avatar Oct 02 '13 01:10 melcher

@melcher got it. Could you please provide a gist (like this one - https://gist.github.com/yatskevich/6400079) which will reproduce the issue?

yatskevich avatar Oct 08 '13 19:10 yatskevich

I see exactly the same problem.

Gist: https://gist.github.com/f-andrejchev-parc/6987681.

andreychev avatar Oct 15 '13 07:10 andreychev

Got that issue too, seems it doesn't work well with nested directories.

mdix avatar Oct 15 '13 12:10 mdix

Ran into the same issue. Would appreciate a fix!

casarock avatar Oct 16 '13 09:10 casarock

This seems broken in Bower, not this task.

If I have a nested .bowerrc, e.g.:

{
  "directory": "./src/components"
}

Running bower install will install the packages correctly to ./src/components but bower list --paths (which is what this task is presumably using) will show them installed to "packagename": "components/packagename", which is obviously incorrect, therefore this task fails.

bcarrell avatar Oct 18 '13 01:10 bcarrell