I am quite new to the Yeoman workflow(started using Yeoman today). I am trying to install grunt bower-install, in order to automate the asset management process.
The problem is that despite the fact I followed the the instructions in the docs to the last of them, when trying to run grunt bower-install
I get errors.
When trying to run this command from the home DIR, the errors are as following:
oleg@ob:~$ !!
Running "bower-install:app" (bower-install) task
Verifying property bower-install.app.src exists in config...ERROR
>> Unable to process task.
Warning: Required config property "bower-install.app.src" missing. Use --force to continue.
Aborted due to warnings.
Execution Time (2014-01-20 10:17:47 UTC)
loading tasks 3ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 25%
bower-install:app 8ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 67%
Total 12ms
After cding into the app directory and running the command again, I get a different error:
oleg@ob:~/app$ grunt bower-install
Loading "gruntfile.js" tasks...ERROR
>> Error: Unable to read "package.json" file (Error code: ENOENT).
Warning: Task "bower-install" not found. Use --force to continue.
Aborted due to warnings.
Any help is much more then greatly appreciated!
My Gruntfile.js (within app/ dir) looks as following:
'use strict';
module.exports = function (grunt) {
// Project configuration
grunt.initConfig({
// Metadata
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= props.license %> */\n',
// Task configuration
concat: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
dist: {
src: ['lib/<%= pkg.name %>.js'],
dest: 'dist/<%= pkg.name %>.js'
}
},
uglify: {
options: {
banner: '<%= banner %>'
},
dist: {
src: '<%= concat.dist.dest %>',
dest: 'dist/<%= pkg.name %>.min.js'
}
},
'bower-install': {
target: {
// Point to the files that should be updated when
// you run `grunt bower-install`
src: ['/home/oleg/index.html'],
// Optional:
// ---------
cwd: '',
ignorePath: '',
exclude: [],
fileTypes: {}
}
},
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
unused: true,
boss: true,
eqnull: true,
browser: true,
globals: {
jQuery: true
}
},
gruntfile: {
src: 'gruntfile.js'
},
lib_test: {
src: ['lib/**/*.js', 'test/**/*.js']
}
},
qunit: {
files: ['test/**/*.html']
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile']
},
lib_test: {
files: '<%= jshint.lib_test.src %>',
tasks: ['jshint:lib_test', 'qunit']
}
}
});
// These plugins provide necessary tasks
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-bower-install');
// Default task
grunt.registerTask('default', ['jshint', 'qunit', 'concat', 'uglify']);
};
You're right to run grunt
commands from the root directory of your project. However, I believe you're running the wrong grunt-bower-install
subtask, judging from this error:
Running "bower-install:app" (bower-install) task
Verifying property bower-install.app.src exists in config...ERROR
>> Unable to process task.
Warning: Required config property "bower-install.app.src" missing.
If you simply run grunt bower-install
, it should work. Either that, or rename
'bower-install': {
target: { /* ... */ }
}
to...
'bower-install': {
app: { /* ... */ }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With