Grunt can't compiles assets/less/main because of a file error in bootstrap?

I’m on a new Ubuntu digital ocean instance with the Wordpress application installed, and I just finished installing roots - when I type grunt build into the command line it fails.

I used grunt -v --force in order to take a closer look at what was going on, and the following error pops up under the header Running "less:dev" (less) task.

Running "less:dev" (less) task
Verifying property less.dev exists in config...OK
Files: assets/less/main.less -> assets/css/main.css
Options: report="min", banner="", compress=false, sourceMap, sourceMapFilename="assets/css/main.css.map", sourceMapRootpath="/app/themes/roots/"

Reading assets/less/main.less...OK
>> FileError: '../vendor/bootstrap/less/variables.less' wasn't found in assets/less/_bootstrap.less on line 8, column 1:
>> 7 // Variables
>> 8 @import "../vendor/bootstrap/less/variables";
>> 9 @import "_variables"; // Bootstrap variable overrides and custom variables

Warning: Error compiling assets/less/main.less Used --force, continuing.
>> TypeError: Cannot call method 'toCSS' of undefined
>>     at minify (/var/www/wp-content/themes/kidscode/node_modules/grunt-contrib-less/tasks/less.js:191:17)
>>     at /var/www/wp-content/themes/kidscode/node_modules/grunt-contrib-less/tasks/less.js:153:15
>>     at Object.finish [as _finish] (/var/www/wp-content/themes/kidscode/node_modules/grunt-contrib-less/node_modules/less/lib/less/parser.js:666:28)
>>     at Object.subFinish [as _finish] (/var/www/wp-content/themes/kidscode/node_modules/grunt-contrib-less/node_modules/less/lib/less/import-visitor.js:87:47)
>>     at Object.subFinish [as _finish] (/var/www/wp-content/themes/kidscode/node_modules/grunt-contrib-less/node_modules/less/lib/less/import-visitor.js:87:47)
>>     at Object.tree.importVisitor.run (/var/www/wp-content/themes/kidscode/node_modules/grunt-contrib-less/node_modules/less/lib/less/import-visitor.js:34:22)
>>     at /var/www/wp-content/themes/kidscode/node_modules/grunt-contrib-less/node_modules/less/lib/less/import-visitor.js:98:38
>>     at fileParsedFunc (/var/www/wp-content/themes/kidscode/node_modules/grunt-contrib-less/node_modules/less/lib/less/parser.js:82:17)
>>     at /var/www/wp-content/themes/kidscode/node_modules/grunt-contrib-less/node_modules/less/lib/less/parser.js:105:29
>>     at finish (/var/www/wp-content/themes/kidscode/node_modules/grunt-contrib-less/node_modules/less/lib/less/parser.js:669:28)
Warning: Error compiling assets/less/main.less Used --force, continuing.

Running "autoprefixer:dev" (autoprefixer) task
Verifying property autoprefixer.dev exists in config...OK
Files: [no src]
Options: cascade, diff=false, map={"prev":"assets/css/"}, browsers=["last 2 versions","ie 8","ie 9","android 2.3","android 4","opera 12"]
Warning: No source files were found. Used --force, continuing.

Running "concat" task

Running "concat:dist" (concat) task
Verifying property concat.dist exists in config...OK
Files: assets/js/_main.js -> assets/js/scripts.js
Options: separator=";", banner="", footer="", stripBanners=false, process=false
Reading assets/js/_main.js...OK
Writing assets/js/scripts.js...ERROR
Warning: Unable to write "assets/js/scripts.js" file (Error code: EACCES). Used --force, continuing.

Done, but with warnings.


Execution Time (2014-08-04 22:23:54 UTC)
loading tasks      7ms  ▇▇▇▇▇▇ 3%
jshint:all        92ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 41%
less:dev          59ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 26%
autoprefixer:dev  49ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 22%
concat:dist       16ms  ▇▇▇▇▇▇▇▇▇▇▇▇ 7%
Total 225ms

If anybody has any idea why grunt is failing, and why vendor just seems to not exist, I would greatly appreciate it.

Can you verify whether assets/vendor/bootstrap/ actually exists? Is it empty? When you run npm install do you encounter any errors? Perhaps with Bower?

Also, why are you building remotely?

Indeed, assets/vendor/bootstrap is not being generated and does not exist.

Yes, npm install did pop out a few errors. I ended up installing bower separately. Now when I run npm install it resolves normally.

If assets/vendor/bootstrap/ still doesn’t exist then try deleting the npm_modules directory and run npm install again. Check for the assets/vendor/ directory and subdirectories and run Grunt if you see them.

I did that. It seems that npm install worked this time without a problem.

However assets/vendor still doesn’t exist.

Have you setup permissions properly on Digital Ocean?

I believe so. However, do you have any docs to point me to to compare ?

Nothing here is different from what I’ve done.

Check that bower is installed properly with bower --version (it should work from anyway if you installed it globally) then cd to the theme root, and run bower install.

We’ve tried to automate the system as best we can (@QWp6t was working on it for a long spell yesterday) but there are just too many setups to promise 100% coverage.

When I run bower --version it pops out: 1.3.8

What happens when you bower install from the theme root? It should create the vendor folder and assets.

Got the same problem but once i did ‘bower install’ from the root as mentioned by Foxall, it fixed.

Thanks!