WordPress Roots theme: “npm install” command raised error on Windows 8/8.1

Today, While setting up the Roots theme 7.0.2 for WordPress 4.0, I came across an issue on Windows 8.1. I installed the node.js and then ran the “npm install” command on theme’s directory. It ran for few secs with a spinner but end up with following errors (ignore number at the start of each line).

44945 info install roots@7.0.2
44946 info postinstall roots@7.0.2
44947 verbose unsafe-perm in lifecycle true
44948 info roots@7.0.2 Failed to exec postinstall script
44949 error roots@7.0.2 postinstall: `bower install`
44949 error Exit status 1
44950 error Failed at the roots@7.0.2 postinstall script.
44950 error This is most likely a problem with the roots package,
44950 error not with npm itself.
44950 error Tell the author that this fails on your system:
44950 error bower install
44950 error You can get their info via:
44950 error npm owner ls roots
44950 error There is likely additional logging output above.
44951 error System Windows_NT 6.2.9200
44952 error command “C:\\Program Files (x86)\\nodejs\\\\node.exe” “C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js” “install”
44953 error cwd E:\wamp\www\wp_bond\wp-content\themes\bond
44954 error node -v v0.10.33
44955 error npm -v 1.4.28
44956 error code ELIFECYCLE
44957 verbose exit [ 1, true ]

Due to the same reason, if you try to run “grunt dev” or “grunt watch”, you will get message similar to this

Running “less:dev” (less) task
>> 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 Use –force to continue.

The solution is to run the command prompt in Administrator mode. 🙂

  1. Press Window button, to open the search panel
  2. Type “cmd”
  3. Right click the “Command Prompt” from the search results
  4. Click on “Run as Administrator”
  5. Now, do the regular thing, “cd” to your theme’s directory and run “npm install” command

Output should look like this now

bower not-cached git://github.com/Modernizr/Modernizr.git#2.8.2
bower resolve git://github.com/Modernizr/Modernizr.git#2.8.2
bower not-cached git://github.com/jquery/jquery.git#1.11.1
bower resolve git://github.com/jquery/jquery.git#1.11.1
bower not-cached git://github.com/twbs/bootstrap.git#3.3.0
bower resolve git://github.com/twbs/bootstrap.git#3.3.0
bower not-cached git://github.com/scottjehl/Respond.git#1.4.2
bower resolve git://github.com/scottjehl/Respond.git#1.4.2
bower download https://github.com/scottjehl/Respond/archive/1.4.2.tar.gz
bower download https://github.com/Modernizr/Modernizr/archive/v2.8.2.tar.gz

bower extract respond#1.4.2 archive.tar.gz
bower resolved git://github.com/scottjehl/Respond.git#1.4.2
bower download https://github.com/jquery/jquery/archive/1.11.1.tar.gz
bower download https://github.com/twbs/bootstrap/archive/v3.3.0.tar.gz
bower progress modernizr#2.8.2 received 0.2MB
bower progress modernizr#2.8.2 received 0.2MB
bower progress modernizr#2.8.2 received 0.3MB
bower progress jquery#1.11.1 received 0.1MB
bower progress modernizr#2.8.2 received 0.3MB
bower progress modernizr#2.8.2 received 0.3MB
bower progress jquery#1.11.1 received 0.2MB
bower progress modernizr#2.8.2 received 0.3MB
bower progress modernizr#2.8.2 received 0.4MB
bower progress jquery#1.11.1 received 0.2MB

….

Now, run Grunt command to compile LESS code.

Advertisements