Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
konsumer opened this issue Mar 4, 2014 · 2 comments
Closed

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

konsumer opened this issue Mar 4, 2014 · 2 comments

Comments

@konsumer
Copy link

konsumer commented Mar 4, 2014

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
Copy link
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.

@konsumer
Copy link
Author

konsumer commented Mar 5, 2014

Cool. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants