Warning: Cannot read property 'main' of undefined #2

konsumer opened this Issue Mar 4, 2014 · 2 comments

2 participants


I have a bower.json file that looks like this:

  "name": "project",
  "version": "0.0.0",
  "license": "MIT",
  "private": true,
  "dependencies": {
    "angular": "~1.2.13",
    "angular-cardflow": "~0.3.2",
    "strapless": "~3.1.1",
    "angular-smoothscroll": "*",
    "angular-bootstrap": "~0.10.0",
    "prefixfree": "konsumer/prefixfree#~1.0.9"
  "resolutions": {
    "angular": "~1.2.13"

a .bowerrc file that looks like this:

  "directory": "app/bower_components"

My Gruntfile.js looks like this:

module.exports = function(grunt) {
    var wiredep=require('wiredep');
    var fs = require('fs');

        'pkg': grunt.file.readJSON('package.json'),

        'cfg': {
            'dist': 'dist',
            'app': 'app',
            'tmp': '.grunt'

        'clean': {
            'prod': { 
                'src': ['<%= cfg.tmp %>', '<%= cfg.dist %>'] 

        injector: {
            options: {
            bower_dependencies: {
                files: {
                    '<%= cfg.app %>/index.html': ['bower.json'],
    grunt.registerTask('default', ['clean:prod', 'injector']);

I do bower install and everything ends up in "app/bower_components".

When I run grunt it spits out this:

Running "clean:prod" (clean) task

Running "injector:bower_dependencies" (injector) task
Missing option `template`, using `dest` as template instead
Warning: Cannot read property 'main' of undefined Use --force to continue.

Aborted due to warnings.
@joakimbeng joakimbeng closed this in 71f44b6 Mar 5, 2014
Klei member

Ah, I didn't think of the possibility to specify directory in .bowerrc!

I've released a new version (0.5.2) of grunt-injector that supports this now.


Cool. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment