yatskevich / grunt-bower-task Goto Github PK
View Code? Open in Web Editor NEWGrunt plugin for Bower
License: MIT License
Grunt plugin for Bower
License: MIT License
Just running the default task, both with no options and with manually setting layout to "byType", it does not group the files by type. Hoping someone can help!
$ grunt bower
Running "bower:install" (bower) task
>> Installed bower packages
>> Copied packages to ~client/lib
Done, without errors.
$ ls ~client/lib
angular angular-mocks bootstrap jquery
My Gruntfile.js
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
bower: {
install: {
//just run 'grunt bower:install' and you'll see files from your Bower packages in lib directory
options: {
targetDir: './client/lib',
layout: 'byType',
cleanBowerDir: false,
install: true
}
}
...
Running grunt bower
creates a lib
directory even if I set copy
to false. My setup is below:
bower:
install:
copy: false
Is there some other setting I need to use?
I like using the grunt-bower-task, rather than just 'bower install', mostly because my CI server can simply run 'grunt' and not worry about whether it's a bower-savvy project. However, I don't want it to install the optimized version of things into 'lib/' (or anywhere else) because my next Grunt step is requirejs, which does this for me.
My solution has been to set targetDir to 'components/'. This makes it so the final copy step just puts the files where they already are.
However, when installing backbone this causes the Grunt task to fail with:
Fatal error: ENOENT, no such file or directory 'components/backbone'
And, sure enough, there is no 'components/backbone' folder. (Oddly, with any other value for targetDir there is a 'components/backbone' folder present when the copy step begins.
Please allow us to either:
Bower was recently updated to add the --force-latest
flag to resolve conflicts.
If I run grunt bower
or just bower install
, I get:
mismatch The version specified in the component.json of package jquery mismatches the tag (1.8.3 vs 1.9.0)
mismatch You should report this problem to the package author
Fatal error: No resolvable dependency for: jquery
If I run bower install --force-latest
, however, I get:
Please note that
Reader requires jquery ~1.9.0
bootstrap requires jquery ~1.8.0
Resorting to using latest version, jquery v1.9.0.
Conflicts may occur.
And then the install continues.
What can be done to incorporate this into grunt-bower-task
?
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)
...
I load a requireJs based lib. As all files that mentioned in the exportsOverride block are put at the main level of lib/js/myDependency/
I cant build the lib with requireJs as the require paths are broken now.
jquery-ui has a different folder structure now and when specified on component.json will cause the build to fail with an error
I've caught an issue with 'handlebars' Bower component. It seems that Bower cached component.json
with incorrect gitHead
( so weird ) pointing to a commit with handlebars-1.0.0-rc1.js
, but after cleaning up Bower's cache file name had been changed to handlebars.js
. grunt-bower-task silently ignored missing file.
In my opinion the task has to report error for precisely specified files and warning for wildcards.
Running bower on every build can be expensive, depending on how you're using Grunt.
I would like to be able to add a value to options that allows for packages to still be copied from components
to the final output directory, but I'd like to skip the calls to Bower itself.
I implemented a --skipBower
flag in my Grunt build, but then realized I didn't have a way of using grunt-bower-task
without it calling Bower to restore packages.
I need this because I always call clean
on my output directory before my build starts.
Thanks!
Hi,
I'm seeing the following error message when I complete a bower install with the grunt-bower-task. Bower installs the dependency correctly, but I still get an error message. This reproduces for me with both specified options and not.
Error:
Installed bower packages
Fatal error: Arguments to path.join must be strings
Configuration:
1 module.exports = function(grunt) {
2 grunt.loadNpmTasks('grunt-bower-task');
3
4 grunt.initConfig({
5 pkg: grunt.file.readJSON('package.json'),
6 bower: {
7 install: {
8 options: {
9 targetDir: 'src/public',
10 layout: 'byType',
11 install: true,
12 verbose: false,
13 cleanTargetDir: false,
14 cleanBowerDir: false
15 }
16 }
17 }
18 });
19 };
This is available in a public project. I will be pushing the change later today:
Is it not possible to use bower in a series of tasks ?
grunt.registerTask('build', ['useminPrepare', 'concat', 'uglify', 'cssmin', 'htmlmin', 'usemin', 'copy:prod'])
grunt.registerTask('default', ['clean', 'bower', 'build']);
But it exits after the bower task?
I'm just running 'grunt' with bower configured as the default and i get the following error:
/Users/srour/friendations/node_modules/grunt-bower-task/node_modules/bower/node_modules/tmp/lib/tmp.js:260
throw err;
^
Error: ENOENT, no such file or directory 'components/bootstrap/docs/assets/js/bootstrap.js'
at Object.fs.statSync (fs.js:684:18)
at null. (/Users/srour/friendations/node_modules/grunt-bower-task/tasks/lib/asset_copier.js:41:23)
at /Users/srour/friendations/node_modules/grunt-bower-task/node_modules/lodash/lodash.js:601:21
at Function.eval (eval at createIterator (/Users/srour/friendations/node_modules/grunt-bower-task/node_modules/lodash/lodash.js:1:0), :10:9)
at lodash.(anonymous function) as each
at null. (/Users/srour/friendations/node_modules/grunt-bower-task/tasks/lib/asset_copier.js:38:16)
at /Users/srour/friendations/node_modules/grunt-bower-task/node_modules/lodash/lodash.js:601:21
at Function.eval (eval at createIterator (/Users/srour/friendations/node_modules/grunt-bower-task/node_modules/lodash/lodash.js:1:0), :25:9)
at lodash.(anonymous function) as each
at Copier.copyAssets (/Users/srour/friendations/node_modules/grunt-bower-task/tasks/lib/asset_copier.js:37:13)
Grunt file:
bower: {
install: {
//just run 'grunt bower:install' and you'll see files from your Bower packages in lib directory
}
}
bower.json:
{
"name": "favens-client",
"version": "0.1.0",
"ignore": [
"*/.",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular-grid": "git://github.com/angular-ui/ng-grid.git#~2.0.7",
"angular-ui-bootstrap-bower": "git://github.com/angular-ui/bootstrap-bower.git#~0.4.0",
"angular-ui": "git://github.com/angular-ui/angular-ui.git#~0.4.0",
"async": "git://github.com/caolan/async.git#~0.2.5",
"angular-underscore": "git://github.com/floydsoft/angular-underscore.git",
"bootstrap": "git://github.com/twbs/bootstrap.git#~3.0.0-rc1",
"node-uuid": "git://github.com/broofa/node-uuid.git#~1.4.0",
"font-awesome": "git://github.com/FortAwesome/Font-Awesome.git#~3.2.1",
"jquery-ui": "git://github.com/components/jqueryui.git#~1.10.3",
"select2": "git://github.com/ivaynberg/select2.git#~3.4.1",
"underscore": "git://github.com/documentcloud/underscore.git#~1.5.1"
}
}
Has anyone else run into an issue where you run grunt bower:install and get the following:
$ grunt bower:install
Loading "bower_task.js" tasks and helpers...ERROR
>> Error: Cannot find module 'grunt'
I use grunt a lot and it works in all other instances, I'm just running a bare bones config just to test the bower-task plugin and I keep getting the error above. I have grunt installed globally, so I tried just installing the grunt package directly in this project (npm install grunt) and then I run the bower task again and get the following:
$ grunt bower:install
Running "bower:install" (bower) task
/Users/rwbennet/Sites/templates/test/node_modules/grunt-bower-task/node_modules/bower/node_modules/tmp/lib/tmp.js:219
throw err;
^
TypeError: Object #<Object> has no method 'options'
at Object.module.exports (/Users/rwbennet/Sites/templates/test/node_modules/grunt-bower-task/tasks/bower_task.js:24:24)
at Object.task.registerMultiTask.thisTask (/Users/rwbennet/Sites/templates/test/node_modules/grunt/lib/grunt/task.js:109:15)
at Object.task.registerTask.thisTask.fn (/Users/rwbennet/Sites/templates/test/node_modules/grunt/lib/grunt/task.js:58:16)
at Task.<anonymous> (/Users/rwbennet/Sites/templates/test/node_modules/grunt/lib/util/task.js:343:36)
at Task.start (/Users/rwbennet/Sites/templates/test/node_modules/grunt/lib/util/task.js:359:5)
at Object.grunt.tasks (/Users/rwbennet/Sites/templates/test/node_modules/grunt/lib/grunt.js:143:8)
at Object.module.exports [as cli] (/Users/rwbennet/Sites/templates/test/node_modules/grunt/lib/grunt/cli.js:36:9)
at Object.<anonymous> (/usr/local/lib/node_modules/grunt/bin/grunt:19:14)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
Not sure what's going on. I attached a screenshot of my config. Any ideas?
bower: {
install: {
options: {
cwd: "<%= meta.target %>",
targetDir: '<%= meta.target %>/Libraries',
layout: 'byType',
install: true,
verbose: true,
cleanTargetDir: false,
cleanBowerDir: false
}
}
},
I'm getting:
Fatal error: status code of git: 1
It doesn't seem to occur when it gets to any bower package in particular
I'm trying to use the new install
option to prevent the installation of packages from occurring when I already have them.
As soon as I set install
to false
, my grunt build dies at grunt-bower-task
-- no failure, warning or other messages -- it just stops dead in it's track (and I always run Grunt in verbose
mode).
I seem to be able to toggle any of the other options without a problem, but install
is having issues.
This is more of a placeholder than anything else... at the moment, there's nothing you can do. Bower is stuck waiting on unzip
and a few others NPM packages to be fixed before they'll fully support Node 0.10.
I tried the 0.8.6
version of Bower which is supposed to work, but in my case, it didn't.
For some reason it only seems to fail with the 'Overthrow' repo but not the 'ua-parser-js' repo. Not really sure how they differ that is causing grunt-bower-task to break. Regular 'bower install' on the CLI works as expected.
{
"directory": "app/lib"
}
...
bower:
install:
options:
targetDir: './app/lib'
verbose: true
install: true
cleanup: true
...
{
"name": "myapp",
"version": "5.0.0",
"dependencies": {
"ua-parser-js": "git://github.com/faisalman/ua-parser-js.git",
"angular": "~1.0.5",
"angular-resource": "~1.0.5",
"angular-loader": "~1.0.5",
"almond": "~0.2.5",
"normalize-css": "~2.1.1",
"Overthrow": "git://github.com/filamentgroup/Overthrow.git"
}
}
Running "bower:install" (bower) task
[notice] cleaning up Bower packages
[notice] cleaning up /home/lrvick/Sources/myapp/app/lib
bower cloning git://github.com/faisalman/ua-parser-js.git
bower cloning git://github.com/filamentgroup/Overthrow.git
bower cached git://github.com/faisalman/ua-parser-js.git
bower fetching ua-parser-js
bower cached git://github.com/filamentgroup/Overthrow.git
bower fetching Overthrow
bower cloning git://github.com/angular/bower-angular-loader.git
bower cached git://github.com/angular/bower-angular-loader.git
bower fetching angular-loader
bower cloning git://github.com/angular/bower-angular-resource.git
bower cached git://github.com/angular/bower-angular-resource.git
bower fetching angular-resource
bower cloning git://github.com/angular/bower-angular.git
bower cached git://github.com/angular/bower-angular.git
bower fetching angular
bower cloning git://github.com/jrburke/almond.git
bower cached git://github.com/jrburke/almond.git
bower fetching almond
bower cloning git://github.com/necolas/normalize.css.git
bower cached git://github.com/necolas/normalize.css.git
bower fetching normalize-css
bower checking out angular#v1.0.6
bower checking out Overthrow#a9b67fc3fface4b8bcfdcd04afddcf32ec8f31f8
bower copying /home/lrvick/.bower/cache/angular/683afc7e2aea6bbad5baa3ce1e59216d
bower copying /home/lrvick/.bower/cache/Overthrow/5881f42920a8f8e89b7665c9570cfccf
bower checking out angular-loader#v1.0.6
bower checking out almond#0.2.5
bower copying /home/lrvick/.bower/cache/angular-loader/3e2f57c55f6b3da22fef32ea9dc4be6f
bower copying /home/lrvick/.bower/cache/almond/60b960607ded4c8e1353bcc1ed881a9e
bower checking out angular-resource#v1.0.6
bower checking out normalize-css#v2.1.1
bower checking out ua-parser-js#v0.6.0
bower copying /home/lrvick/.bower/cache/angular-resource/8af0e3f889969e27f60f8957c51eb157
bower copying /home/lrvick/.bower/cache/normalize-css/71749c4026739d2551e50a1081bd0936
bower copying /home/lrvick/.bower/cache/ua-parser-js/25e984f1295a73e7175510e1b4345748
bower cloning git://github.com/angular/bower-angular.git
bower cached git://github.com/angular/bower-angular.git
bower fetching angular
bower checking out angular#v1.0.6
bower copying /home/lrvick/.bower/cache/angular/683afc7e2aea6bbad5baa3ce1e59216d
bower installing ua-parser-js#0.6.0
bower installing angular#1.0.6
bower installing angular-resource#1.0.6
bower installing angular-loader#1.0.6
bower installing almond#0.2.5
bower installing normalize-css#2.1.1
bower installing Overthrow#a9b67fc3fface4b8bcfdcd04afddcf32ec8f31f8
Fatal error: ENOENT, no such file or directory 'app/lib/Overthrow'
Hi,
I was hopping to use this grunt plugin to effectively use bower without the dependency of bower cli.
my current settings are
bower: {
install: {
options: {
targetDir:"src/common",
layout:"byComponent",
cleanBowerDir:true,
install:true
}
}
},
which i expected would look at my bower.json file and then install those components into src/common directory and leave no trace of bower_components directory etc
i dont get any files but also no errors. am i missing something?
>> Installed bower packages
Reading /Users/chrismatheson/iv/iVendi-angular/bower.json...OK
Parsing /Users/chrismatheson/iv/iVendi-angular/bower.json...OK
any help would be great, thanks.
I am creating an SDK for a few projects, so that they can share grunt packages between them. Accordingly, I am calling grunt files from outside my base directory with my NPMs.
e.g. grunt --gruntfile ../widgets/basic-text/build.js --base . bower:install
bower: {
install: {
options: {
targetDir: '../widgets/basic-text/src/lib',
layout: 'byComponent',
cleanup: true,
verbose: true
}
}
}
Running "bower:install" (bower) task
[notice] cleaning up Bower packages
[notice] cleaning up /Users/ryanunger/foobar/widgets/basic-text/src/lib
/Users/ryanunger/foobar/sdk/node_modules/grunt-bower-task/node_modules/bower/node_modules/tmp/lib/tmp.js:219
throw err;
^
Error: Unable to read "/Users/ryanunger/foobar/sdk/component.json" file (Error code: ENOENT).
at Object.util.error (/Users/ryanunger/foobar/sdk/node_modules/grunt/lib/grunt/util.js:57:39)
at Object.file.read (/Users/ryanunger/foobar/sdk/node_modules/grunt/lib/grunt/file.js:237:22)
at Object.file.readJSON (/Users/ryanunger/foobar/sdk/node_modules/grunt/lib/grunt/file.js:243:18)
at BowerAssets.get (/Users/ryanunger/foobar/sdk/node_modules/grunt-bower-task/tasks/lib/bower_assets.js:17:32)
at EventEmitter.module.exports (/Users/ryanunger/foobar/sdk/node_modules/grunt-bower-task/tasks/bower_task.js:76:40)
at EventEmitter.emit (events.js:93:17)
at module.exports (/Users/ryanunger/foobar/sdk/node_modules/grunt-bower-task/node_modules/bower/lib/commands/install.js:41:17)
at EventEmitter.emit (events.js:96:17)
at g (events.js:192:14)
at EventEmitter.emit (events.js:93:17)
I think the use of cwd
in ./lib/bower_assets.js
is the root cause of this bug. Can the location of the component.json
file be an optional variable?
Hi
grunt-bower-task is our dependency manager of choice and works quite well.
Our structure has a src-folder, bower dependencies get installed to src/vendor - i.e. tracking gets installed to src/vendor/tracking (built files are stored in dist/)
To archieve the folder structure we are using exportsOverride. For tracking it could be
tracking-Package using anotherPackage:
"anotherPackage": {
"": "dist/"
}
so that only built files from the dist folder get copied to src/vendor/anotherPackage/
The problem arises when someone else is including the tracking-package - one would only use exportsOverride for that:
secondLevel-Package using tracking
"tracking": {
"": "dist/"
}
But now the information for anotherPackage is not set. The owner of the secondLevel-Package does not even know that tracking is depending on anotherPackage. Unfortunatelly now anotherPackage gets installed to src/vendor/anotherPackage, but all its contents, not just the dist-folder => referencing anotherPackage from tarcking does not work anymore, since tracking is assuming to find the main file in src/vendor/anotherPackage, not in src/vendor/anotherPackage/dist
Any ideas beside to state sub-dependencies explicitly?
Greetings
Benedikt
p.s.: We are using require-js on the client-side. First Level Dependencies always are referenced via vendor/anotherPackage which works in developement as well as when the package is a dependency itself:
tracking => vendor/anotherPackage
hook => vendor/tracking => vendor/anotherPackage
I'd do this myself, but I'm not familiar enough with the codebase to know whether code needs to be changed, or just revising the package.json
is enough. :-)
Thanks, for this awesome task :)
I have a project that needs to split vendor library into js, css and img folder. Seems that currently only css and js are supported?
Hi, here's the workflow in steps:
components.json
grunt bower
)components.json
At this point, previously installed modules will still be copied in the project folder. This seems to occur because the task use all folder in components
and don't clear removed dependencies.
EDIT: never mind... it seems like a bug in bower. I've submitted a pull request there: bower/bower#474
Some bower packages like backbone and underscore dont have a name reference on their component.json file, ideally we could check the property main on package.json as a fallback. I did a test and it worked fine, will do a pull later on, i think this would be a great adition.
grunt-bower-task uses default targetDir as lib
whereas bower uses bower_components
. This results in creating two different folders.
Disclaimer: I have just started to learn Grunt and please forgive my ignorance.
Thanks
First, thanks for this task! Looks awesome. I can't wait to use Bower in my Grunt workflows. 👍
With that said, I can't figure out how to install packages.
I'm sure it's obvious, but ... The docs don't have an example of what to do once you've setup all the Grunt requirements.
For example, I'd like to install normalize.css, which says:
…or install with Bower.
bower install --save normalize-css
How do I translate that to grunt-bower-task
speak?
Do I need to setup a bower.json
?
Sorry, the README
doesn't mention any of this (unless I missed it) and I'm new to Bower, so I'm left scratching my head.
I'll post back here if/when I figure it out (I'm sure this info will help other Bower noobs like me).
Even if I declare a exportsOverride
section, the whole git repo will be pushed into my components folder. I'm using grunt v0.4.0rc7 and this is my component.json
:
{
"name": "name",
"version": "0.0.1",
"dependencies": {
"backbone": "0.9.~",
"lodash": "1.0.~",
"highcharts.com": "2.~"
},
"exportsOverride": {
"backbone": {
"js": "backbone.js"
},
"lodash": {
"js": "lodash.js"
},
"highcharts.com": {
"js": "highcharts.js"
}
}
}
Bower has a 'prune' function that cleans my component directory of any libraries no longer listed in my bower.json file. It would be nice if I could add that to my grunt file, to install new components, and prune out old ones I am no longer using.
Use cases:
It would even better to define the exportsOverride in the grunt file instead of the bower.json so you have target specific builds out of the box.
Would it be possible to read the package.json
file too ? Because it does seem like some repositories don't have a bower.json
or components.json
file, but they specify the main fail tough inside their package.json
.
Also what could I do to filter for instance the modernizr repository ? Because it doesn't have a package.json
nor a bower.json
or anything that could tell us which is the main file. I was thinking of using the folder name, or the name of the repository to Regex find something that contains that name ?
I'm posting this issue to let you know that we will be publishing Grunt 0.4 on Monday, February 18th.
If your plugin is not already Grunt 0.4 compatible, would you please consider updating it? For an overview of what's changed, please see our migration guide.
If you'd like to develop against the final version of Grunt before Monday, please specify "grunt": "0.4.0rc8"
as a devDependency in your project. After Monday's release, you'll be able to use "grunt": "~0.4.0"
to actually publish your plugin. If you depend on any plugins from the grunt-contrib series, please see our list of release candidates for compatible versions. All of these will be updated to final status when Grunt 0.4 is published.
Also, in an effort to reduce duplication of effort and fragmentation in the developer community, could you review the grunt-contrib series of plugins to see if any of your functionality overlaps significantly with them? Grunt-contrib is community maintained with 40+ contributors—we'd love to discuss any additions you'd like to make.
Finally, we're working on a new task format that doesn't depend on Grunt: it's called node-task. Once this is complete, there will be one more conversion, and then we'll never ask you to upgrade your plugins to support our changes again. Until that happens, thanks for bearing with us!
If you have any questions about how to proceed, please respond here, or join us in #grunt on irc.freenode.net.
Thanks, we really appreciate your work!
(Note: I'm total newbie in this area, so - sorry if this a bad way to ask)
Is it possible/sane/logic to set up grunt-bower-task to use globally installed bower?
I'm playing with mean stack on win and grunt-bower-task installs bower locally and it leads to very long paths which can be problem on windows - e.g.:
c:...\mean-test\node_modules\grunt-bower-task\node_modules\bower\node_modules\update-notifier\node_modules\request\node_modules\form-data\node_modules\combined-stream\node_modules\delayed-stream\test\integration\test-delayed-stream-auto-pause.js
If my ...\ part is not very short (which is not), the path exceeds windows path length limit.
Thanks
Looks like there is a left over console.log displaying "[object Object]"
I have the following bower.json
:
{ "name": "DrawerJS", "version": "0.0.0", "main": "src/drawer.js", "ignore": [ ".bowerrc", "*.env", ".gitignore", "*.json", "*.md", "*.js", "*.txt", "Procfile", "components/*", "docs/**", "node_modules/**", "public/**" ], "dependencies": {}, "devDependencies": { "jquery": "2.0.3", "modernizr": "2.6.2", "underscore": "1.5.1", "angular-unstable": "1.1.5" }, "exportsOverride": { "modernizr": { "/js/vendor/": "modernizr.js" }, "underscore": { "/js/vendor/": "underscore.js" }, "*": { "/js/vendor/": "*.js" } } }
And the grunt task is configured as such:
bower: { options: { targetDir: "./public/" }, install: {} }
According to you documentation and to my settings all the js folders / files with the dependencies should be going to /public/js/vendor/nameOfDependency/someFile.js
. But instead, whatever comes after I define how should modernizr
and underscore
behave goes to /public/nameOfDependency/someFile.js
. I think that this should not be happening, as you documented, whatever is handled by the wildcard should be thrown intto the /public/js/vendor/
folder too, but it isn't.
Am I doing the configuration wrong or is it a bug ?
Just curious if I'm doing something wrong here.
$ grunt bower:install
Running "bower:install" (bower) task
>> Cleaned target dir /Volumes/[snipped]/files/plugins
bower not-cached https://github.com/necolas/normalize.css.git=https://github.com/necolas/normalize.css.git#2.1.3
bower resolve https://github.com/necolas/normalize.css.git=https://github.com/necolas/normalize.css.git#2.1.3
Fatal error: Failed to execute "git ls-remote --tags --heads https://github.com/necolas/normalize.css.git=https://github.com/necolas/normalize.css.git", exit code of #128
$ bower -v
1.1.2
My bower.json
:
{
"name": "test",
"version": "0.0.0",
"dependencies": {
"https://github.com/necolas/normalize.css.git": "2.1.3"
}
}
Task:
bower : {
install : {
options : {
targetDir : './files/plugins',
cleanup: true,
verbose: true,
},
},
},
Running grunt-bower-task
v0.3.2
.
When I try installing the above using Bower (outside of grunt):
$ bower install https://github.com/necolas/normalize.css.git#2.1.3
bower normalize.css#2.1.3 not-cached https://github.com/necolas/normalize.css.git#2.1.3
bower normalize.css#2.1.3 resolve https://github.com/necolas/normalize.css.git#2.1.3
bower normalize.css#2.1.3 checkout v2.1.3
bower normalize-css#2.1.3 resolved https://github.com/necolas/normalize.css.git#2.1.3
bower normalize-css#2.1.3 install normalize-css#2.1.3
normalize-css#2.1.3 bower_components/normalize-css
What am I doing wrong?
Sorry in advance for being a bother.
Ideally I could do something where I replace the main file with something like this.
"overrides": {
"font-awesome": {
"main": [
"css/font-awesome.min.css",
"font/FontAwesome.otf",
"font/fontawesome-webfont.eot",
"font/fontawesome-webfont.svg",
"font/fontawesome-webfont.ttf",
"font/fontawesome-webfont.woff"
]
}
}
I posted something here about it, I'm very frustrated with bower and grunt.
I'm trying to call the bower
task inside a Vagrant VM at my project's root (/vagrant
, which points to a folder outside the Vagrant VM).
When I call it outside the Vagrant VM—on my normal command line—it works fine, however, inside the Vagrant VM I get—
Running "bower:install" (bower) task
Fatal error: spawn ENOENT
I think the error occurs within bower.commands.install()
; I'm going to assume it happens because /vagrant
isn't a "normal" folder.
Have you seen this kind of issue before?
I've recently upgraded to bower 1.0
Running the grunt task failed with this error.
Running "bower_install:install" (bower_install) task
Fatal error: Failed to read /Users/thomaswelton/Sites/nokia-925/bower.json
After a little while I ran bower install
outside of grunt from the terminal and got a much more useful error message.
bower EINVALID Failed to read /Users/thomaswelton/Sites/nokia-925/bower.json
Additional error details:
No name property set
Bower has a command to validate the bower.json https://github.com/bower/json
Looks like this may return useful messages.
Maybe we should add in validation and return more useful error messages by default. This may be useful if the requirements of the bower spec change again in the future.
Happy to submit a PR, let me know your thoughts.
For project that happened to have a few file with the same name, grunt-bower-task with "layout":"byType" + exportOverride only take the last instance of file.
Exemple:
Bourbon.io:
"/app/assets/stylesheets/css3/_linear-gradient.scss"
"/app/assets/stylesheets/functions/_linear-gradient.scss"
Same file name but different folder, grunt-bower-task will copy only the last one.
Hi,
I'd like to export chosen files directly into ./lib// folder.
With the options at the moment it does not seem possible
{
"exportsOverride": {
"somePackage": {
"js": "dist/**"
}
}
could be
{
"exportsOverride": {
"somePackage": ['dist/**']
}
Unfortunatelly I just cannot say main: ['dist/**'] in the package's component.json
Greetings
Benedikt
Hi,
I'm using new bower naming convention in my projects and I think it would be nice if:
bower.taskname.componentsJSON = 'customPackageFile.json'
What do you think about it?
Versions:
Error is:
Fatal error: ENOENT, no such file or directory 'C:\myProject\components\jscache'
I get this error intermittently. I first clean the components
dir, then run install
with a targetDir
of components
. I'd expect the bower component to create this directory.
For this test I've honed the bower.json
file to simply this:
{
"dependencies": {
"jscache":"latest"
}
}
If I run the same grunt clean bower
command over and over again, sometimes I get the error, sometimes not. Here's a full sample of the output:
mets-client$ grunt clean bower
Running "clean:all" (clean) task
Cleaning "components"...OK
Running "bower:install" (bower) task
>> Installed bower packages
Fatal error: ENOENT, no such file or directory 'C:\myProject\components\jscache'
mets-client$ grunt clean bower
Running "clean:all" (clean) task
Cleaning "components"...OK
Running "bower:install" (bower) task
>> Installed bower packages
If I run bower directly from the command line I get no issues.
I have tried no option (so byType), and explicitly bytype and byComponent, neither seems to do any good. Testing with bootstrap. Expects js and css in different folders. End up in same folder.
It looks like this.
lib
|
--bootstrap
|
--bootstrap.css
--bootstrap.js
If the value of a package's main
attribute is an array, the paths in that array are joined into one string and installation fails.
This seems to be due to a bug in the list
command in Bower. At least diffing the version grunt-bower-task
depends on (in my case it installed 1.1.2) with the latest (1.2.4) the join(',')
has been removed.
A solution would be to upgrade Bower.
I would like to be able to install bower files only and not copy them to a alternative directory.
Suggested:
{
targetDir: false // disable copying files
}
This is on a win x64 machine using git-bash, node 10.9, and grunt-bower-task 0.2.4
Here's the snippet from bower.json
"dependencies": {
"text": "~2.0.6"
},
Here's the target
bower: {
install: {
options: {
install: true,
targetDir: 'webapp/V3RS10N/components/'
}
}
}
If I change it to this it works fine however
bower: {
install: {
options: {
install: true,
targetDir: 'webapp/V3RS10N/'
}
}
}
Here's the error
c:\Users\jdivock\workspace\arch-test\src\main\node_modules\grunt-bower-task\node
_modules\bower\node_modules\tmp\lib\tmp.js:260
throw err;
^
Error: ENOENT, no such file or directory 'c:\Users\jdivock\workspace\arch-test\src\main\webapp\V3RS10N\components\text'
at Object.fs.statSync (fs.js:684:18)
at Object.exports.copyDirSyncRecursive (c:\Users\jdivock\workspace\arch-test\src\main\node_modules\grunt-bower-ask\node_modules\wrench\lib\wrench.js:174:23)
at null.<anonymous> (c:\Users\jdivock\workspace\arch-test\src\main\node_modules\grunt-bower-task\tasks\lib\asset_copier.js:49:16)
at c:\Users\jdivock\workspace\arch-test\src\main\node_modules\grunt-bower-task\node_modules\lodash\lodash.js:601:21
at Function.eval (eval at createIterator (c:\Users\jdivock\workspace\arch-test\src\main\node_modules\grunt-bower-task\node_modules\lodash\lodash.js:645:19),
<anonymous>:10:9)
at lodash.(anonymous function) [as each] (c:\Users\jdivock\workspace\arch-test\src\main\node_modules\grunt-bower-task\node_modules\lodash\lodash.js:3642:27)
at null.<anonymous> (c:\Users\jdivock\workspace\arch-test\src\main\node_modules\grunt-bower-task\tasks\lib\asset_copier.js:38:16)
at c:\Users\jdivock\workspace\arch-test\src\main\node_modules\grunt-bower-task\node_modules\lodash\lodash.js:601:21
at Function.eval (eval at createIterator (c:\Users\jdivock\workspace\arch-test\src\main\node_modules\grunt-bower-task\node_modules\lodash\lodash.js:645:19), <anonymous>:25:9)
at lodash.(anonymous function) [as each] (c:\Users\jdivock\workspace\arch-test\src\main\node_modules\grunt-bower-task\node_modules\lodash\lodash.js:3642:27)
Right now all dependencies are copied to targetDir. It would be useful to be able to skip the devDependencies (jasmine etc) from being copied to prevent cluttering the targetDir.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.