Grunt build not working in Yo Angular

1k views Asked by At

I build a Angular App with Yo angular-genertor,

I was building the app with Grunt Build fine, then I added Bootstrap 3 and also npm install grunt-bower-install

I added these lines to the Grunt file

module.exports = function (grunt) {


  require('load-grunt-tasks')(grunt);

  require('time-grunt')(grunt);

  //ADDED THIS LINE
  grunt.loadNpmTasks('grunt-bower-install');

  grunt.initConfig({

    yeoman: {
      // configurable paths
      app: require('./bower.json').appPath || 'app',
      dist: 'dist'
    },
     //ADDED THESE LINES
    'bower-install': {
        target: {
            src: [
              'app/index.html'
            ],

          }
        },

I have removed these line however!

Now Grunt Build is throwing this error

Running "bowerInstall:app" (bowerInstall) task
Warning: Cannot read property 'main' of undefined Use --force to continue.

Aborted due to warnings.

I do know what to do or even where to start?

2

There are 2 answers

0
zishe On

In my yeoman generated project this task looks like:

'bower-install': {
  app: {
    html: '<%= yeoman.app %>/index.html',
    ignorePath: '<%= yeoman.app %>/'
  }
},

In newer version instead of html uses src:

'bowerInstall': {
  app: {
    src: ['<%= yeoman.app %>/index.html'],
    ignorePath: '<%= yeoman.app %>/'
  }
},

Maybe you adapt it to your case. Though i think it should work without changes.

But you have almost the same, so maybe the problem in another place.

2
Vishal Sakaria On

I found the answer,

I simply needed to run Bower Install,