Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
konsumer opened this Issue · 2 comments

2 participants

@konsumer

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');

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

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

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

        injector: {
            options: {
                addRootSlash:false,
                ignorePath:'app'
            },
            bower_dependencies: {
                files: {
                    '<%= cfg.app %>/index.html': ['bower.json'],
                }
            }
        }
    });
    require('load-grunt-tasks')(grunt);
    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
@joakimbeng
Owner

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.

@konsumer

Cool. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.