gruntjsbowergrunt-wiredep

Grunt wiredep to inject bower components issues


I'm using the grunt task wiredep to inject all of my bower components into my index.html and having some issues. I'm trying to start very basic like so -

wiredep: {
      target: {
        src: 'index.html'
        }
    },

in index I just have

  <!-- bower:js -->
  <!-- endbower -->

  <!-- bower:css -->
  <!-- endbower -->

Everything else is injected properly however when I run the task I'm getting this error.

  Running "wiredep:target" (wiredep) task
   Warning: ENOENT, no such file or directory '/project/bower.json' Use --force to continue.

Having trouble debugging this - could use any help!

I also have my .bowerrc pointing to the right directory (I think)

{
     "directory": "bower_components"
}

Solution

  • have you create the bower.json file on project/ directory? if you haven't, run

    $ bower init
    

    and fill the answers. When it asks you to

    set currently installed components as dependencies?`
    

    answer yes. the new bower.json file is now generated and will be populated according to your existing bower packages.