Bug with built assets on Windows

I opened this up as an issue on github however it was swiftly closed see: https://github.com/roots/sage/issues/1351

This is still an issue. Just to clarifty, where modernizr is being called as a file in assets.php, upon the gulp process running modernizr is being minified into main.js however the call to dist/js/modernizr.js remains and is called. This results in a 404 error on the file. However because modernizr is minified and still included it works as expected.

Please see the outputted main.js file with modernizr minified at: https://gist.github.com/CraigPearson/01abf6e33d28c8c3291d

This is on a Windows 7 machine with:

Gulp 3.8.11
Bower 1.3.12
Node 0.10.24

1 Like

GitHub is for issues, this is the place for support. We can do back and forth over here — GH isn’t the place for that.

This shouldn’t be happening on a default Sage installation. Did you modify anything?

There shouldn’t be any 404s since a modernizr.js file is created on build.

Trying to replicate this right now

May I suggest that you link to this issue on the closed topic? There was another user experiencing this issue and he/she may be able to help. I didn’t mean to come across as ungrateful, you guys are doing a brilliant job but it seemed a bit abrupt just closing the issue.

Regardless I have replicated this issue on another Windows 7 machine with a fresh install of 64bit Node, latest npm, bower and gulp and I’m getting the same issue where the modernizr.js is being minified to main.js

Could you possibly point me in the direction where the the operation to create the modernizr.js file is run/where the main.js file is compiled so that I can help resolve the issue?

To clarify this is a basic install and nothing has been changed. My current test environment is a clean machine which didn’t have node.js or any packages installed previously which eliminates any possible conflict in that area.

I’m having a similar issue with Sage 8.0.0. but in my case both Modernizr and jQuery are minified into main.js and they are not created in the dist folder on build. Tried with gulp, gulp build and gulp --production.
I’m using Windows 7 (64 bit) and node 0.12.0, npm 2.6.0, bower 1.3.12, gulp 3.8.11. don’t know if this is necessary but here is the main.js file (https://gist.github.com/slobich/b2def7bb1aedb5211bf6). i tried both by cloning the repo and downloading the zip file and got the same results.

1 Like

Ok so tried 64bit node 0.10.24 and it works on mac and linux.

So gotta be windows issue. Spawning windoze instance as we speak.

Can you try this?

clone down: https://github.com/austinpray/asset-builder.git
and then run “npm test” in the project directory?

All the fancy path management is done by asset-builder so if those tests fail then that will tell us it is an issue with asset-builder and windows. https://github.com/austinpray/asset-builder

In addition I have a main.js.map file which looks like so, if this helps:


Apologies but just for clarification should asset-builder contents be placed in the same directory as sage and then I run “npm test” or should I run “npm test” in the asset-builder directory isolated?

When running in an isolated folder the npm test fails with the following notice @austin :

 foreach dep
      √ should loop through the dependencies

  28 passing (15s)
  1 failing

  1) Integration Tests manifests roots manifest default roots manifest:
     AssertionError: expected 'C:\\Users\\Craig\\Downloads\\asset-builder-master
\\asset-builder-master\\test\\tmp\\bower_components\\modernizr\\modernizr.js' to
 not include 'modernizr'
      at Function.assert.notInclude (C:\Users\Craig\Downloads\asset-builder-mast
      at C:\Users\Craig\Downloads\asset-builder-master\asset-builder-master\test
      at arrayEach (C:\Users\Craig\Downloads\asset-builder-master\asset-builder-
      at Function.forEach (C:\Users\Craig\Downloads\asset-builder-master\asset-b
      at Context.<anonymous> (C:\Users\Craig\Downloads\asset-builder-master\asse
      at callFn (C:\Users\Craig\Downloads\asset-builder-master\asset-builder-mas
      at Test.Runnable.run (C:\Users\Craig\Downloads\asset-builder-master\asset-
      at Runner.runTest (C:\Users\Craig\Downloads\asset-builder-master\asset-bui
      at C:\Users\Craig\Downloads\asset-builder-master\asset-builder-master\node
      at next (C:\Users\Craig\Downloads\asset-builder-master\asset-builder-maste
      at C:\Users\Craig\Downloads\asset-builder-master\asset-builder-master\node
      at next (C:\Users\Craig\Downloads\asset-builder-master\asset-builder-maste
      at Immediate._onImmediate (C:\Users\Craig\Downloads\asset-builder-master\a
      at processImmediate [as _immediateCallback] (timers.js:358:17)

yeah put it as a completely separate directory. It’s built as a standalone project

Haha trying to use the Modern.ie vms and it’s terrible. Went ahead and just finally bought a windows 8.1 license. :sunglasses:

Yep, I spun up a Win7 box and got the same issue.

Well I knew 100% test coverage would come in handy one day.

I’m wrestling with trying to buy windows 8.1 from the microsoft store right now but I’ll debug shortly after. It’s probably something simple. You can noodle with: https://github.com/austinpray/asset-builder @ https://github.com/austinpray/asset-builder/blob/master/test/test.js#L318 and https://github.com/austinpray/asset-builder/blob/master/lib/buildGlobs.js

I probably just got super lazy with the cross-platform stuff. I’ll get a windows CI running.

1 Like

You can follow my progress over at: https://github.com/austinpray/asset-builder/tree/windoze

I set up windows continuous integration for the project so it is unlikely we will have windows regressions in the future.

1 Like

Alright this appears to be fixed. Everyone try:

npm install asset-builder@beta

To install the patch. Then run your gulp stuff.


Wow… that was super fast…

The fix is working for my issues (both Modernizr and jQuery). Both scripts get compiled and minified in the dist folder. Tried all 3 tasks (gulp, gulp build and gulp --production) and working on all 3.

@austin thank you for all your help.

1 Like

@slobich my pleasure!

asset-builder 1.0.1 is published so
npm install asset-builder@latest --save-dev should fix everyone right up


Tagged Sage 8.0.1 with the fix: https://github.com/roots/sage/releases/tag/8.0.1

1 Like

Wow that’s amazing response, thanks a lot Austin and Ben, much appreciated!

Hey Guys,

I am on windows 8.1 as well and have just installed the asset-builder latest version.

I am getting:

[23:47:31] Using gulpfile C:\wamp\www\nces.
[23:47:31] Starting ‘clean’…
[23:47:31] Finished ‘clean’ after 13 ms
[23:47:31] Starting ‘default’…
[23:47:31] Starting ‘wiredep’…
[23:47:31] Starting ‘jshint’…
[23:47:32] Starting ‘fonts’…
[23:47:32] Starting ‘images’…
[23:47:36] Finished ‘default’ after 4.68 s
[23:47:36] gulp-imagemin: Minified 0 images
[23:47:36] Finished ‘images’ after 3.45 s
[23:47:36] Finished ‘wiredep’ after 4.91 s
[23:47:36] Starting ‘styles’…
[23:47:36] ‘styles’ errored after 6.2 ms
[23:47:36] AssertionError: missing path
at Module.require (module.js:363:3)
at require (module.js:384:17)

Any ideas?


I just cloned Sage (8.0 and then 8.0.1) and got this error when running gulp or gulp --production.

Windows 7
Node: v0.10.20
NPM: 2.6.0
Bower: 1.3.12

Let me know if you need any more info.

$ gulp
[17:51:37] Using gulpfile c:\Dropbox\sites\testsite\wp-content\themes\sage\gulpfile.js
[17:51:37] Starting 'clean'...
[17:51:37] Finished 'clean' after 3.18 ms
[17:51:37] Starting 'default'...
[17:51:37] Starting 'wiredep'...
[17:51:38] Starting 'jshint'...
[17:51:38] Starting 'fonts'...
[17:51:39] Starting 'images'...
[17:51:39] Finished 'default' after 1.92 s
[17:51:39] gulp-imagemin: Minified 0 images
[17:51:39] Finished 'images' after 672 ms
[17:51:39] Finished 'wiredep' after 2.07 s
[17:51:39] Starting 'styles'...
[17:51:40] 'styles' errored after 243 ms
[17:51:40] AssertionError: path must be a string
at Module.require (module.js:362:3)
at require (module.js:380:17)
at requireFn (c:\Dropbox\sites\testsite\wp-content\themes\sage\node_modules\gulp-load-plugins\index.js:37:14)
at Object.defineProperty.get (c:\Dropbox\sites\testsite\wp-content\themes\sage\node_modules\gulp-load-plugins\index.js:68:18)
at cssTasks (c:\Dropbox\sites\testsite\wp-content\themes\sage\gulpfile.js:83:14)
at c:\Dropbox\sites\testsite\wp-content\themes\sage\gulpfile.js:147:28
at arrayEach (c:\Dropbox\sites\testsite\wp-content\themes\sage\node_modules\asset-builder\node_modules\lodash\index.js:1317:13)
at Function.forEach (c:\Dropbox\sites\testsite\wp-content\themes\sage\node_modules\asset-builder\node_modules\lodash\index.js:5958:11)
at Manifest.forEachDependency (c:\Dropbox\sites\testsite\wp-content\themes\sage\node_modules\asset-builder\lib\Manifest.js:47:5)
at Gulp.<anonymous> (c:\Dropbox\sites\testsite\wp-content\themes\sage\gulpfile.js:146:12)
[17:51:40] Finished 'jshint' after 1.83 s
[17:51:40] Finished 'fonts' after 1.28 s