Warning: Cannot read property 'contents' of undefined Use --force to continue

Hi all, please i’m super noobie to grunt and bower and the rest of the lot. I am quite familiar with wordpress and i wanted to give roots starter theme a try, but its been giving me problems the whole day.

My development environment is set up on OS Yosemite and i have followed (trying to follow) the instructions that helps set up roots in wordpress and i keep facing this error.

Running "less:dev" (less) task
Warning: Cannot read property 'contents' of undefined Use --force to continue.

Aborted due to warnings.

Any suggestions please,
thank you very much.

Hey there @govnaah -

First, would you please double-check that npm install and bower install run correctly, with no errors?

Next, it looks like someone just had a similar (maybe) issue: Installing on Ubuntu 14.04 - Roots 7.0.2, and their directory was missing the .bowerrc and the .jshintrc files. Can you make sure those are in there?

You could also attempt clearing your node stuff out, and the cache: rm -rf node_modules and rm -rf ~/.npm, npm cache clean

Let us know how it goes!

thank you so much for the reply. @JulienMelissas
my directory has the listed files available. And i tried running the code you sent me and re-followed the get started, but still same error.

What i did find out while messing with the gruntfile.js was, when i comment out ‘less:dev’,‘autoprefixer:dev’; (found on line 166 and 167).

it works fine. But, i end up not having main.css in my css folder.

can you post the contents of your less: task? Im wondering if there is an issue with sourceMap. Can you try turning it to false, uncomment out less:dev and autoprefixer:dev and try again?

@ewafford, i commented it out an tried. it run fine with no errors, but i have no main.css and main.css.map in my directory after the script is done.

less: {
      dev: {
        files: {
          'assets/css/main.css': [
        options: {
          compress: false,
          // LESS source map
          // To enable, set sourceMap to true and update sourceMapRootpath based on your install
          sourceMap: true,
          sourceMapFilename: 'assets/css/main.css.map',
          sourceMapRootpath: '/app/themes/roots/'
      build: {
        files: {
          'assets/css/main.min.css': [
        options: {
          compress: true

the part below is where i commented out:

grunt.registerTask('dev', [
// 'less:dev',
// 'autoprefixer:dev',

Looking at this makes me think that maybe there is an issue in your version of LESS?
There is also indication that this might be an issue with your actual LESS code, such as syntax errors. Have you made any changes to the default LESS files? Styled anything?

@ewafford, i have not changed anything. its straight from git, no modifications done on any of the files by me.

So i run

grunt --version 

grunt-cli v0.1.13
grunt v0.4.5

and i run

grunt-contrib-less --version


i don’t know if this is the right version i’m supposed to be using.

Can you give us some information about your dev environment then? I’m not seeing anything immediately pop out at me, but I have a sneaking suspicion that its not directly roots related.

Have you tried just trying to roll a test with grunt/less? You could try to create a basic grunt file to compile a simple less file and see if that works?

Yes, I’d love to more about your local development setup. Also, you’re trying to run grunt dev, right? What happens when you run grunt build?

Hi all, i’m out of my depression with trying to get the grunt to work.
@JulienMelissas and @ewafford, sorry for the delay. My environment was setup using this tutorial osx-web-development environment,

My OS: OS X Yosemite (10.10.1).

i placed my localhost files in


And, this is my virtual host settup:

<Directory "/www/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all

<Virtualhost *:80>
    VirtualDocumentRoot "/www/"
    ServerName sites.dev
    UseCanonicalName Off

  <Virtualhost *:80>
    VirtualDocumentRoot "/www/sites/%1/wwwroot"
    ServerName sites.dev
    ServerAlias *.dev
    UseCanonicalName Off

okay great, i have solved that problem.
The problem was to do with permission issues. my environment was setup in the home (/) directory and i simply moved it in my_user (/Users/your_username/) directory. that way, write priviledges are allowed.

Thank you all for the time you took to help.
Much appreciated.

1 Like

I was having this same issue on Win 7 when trying to work with Roots 7.0.3.

I tried various fixes listed above, as well as attempting to use Roots 7.0.2 which was previously working for me, though this time I started getting the error with it as well.

I reinstalled/upgraded node.js with the latest version then tried setting up 7.0.3 again and this time it worked without the error.