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:

https://gist.githubusercontent.com/CraigPearson/8870d2b675f10145f8bb/raw/a7ed1c141e4e1f1205f2f2222668159e8687517c/main.js.map

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
er\asset-builder-master\node_modules\chai\lib\chai\interface\assert.js:715:52)
      at C:\Users\Craig\Downloads\asset-builder-master\asset-builder-master\test
\test.js:318:18
      at arrayEach (C:\Users\Craig\Downloads\asset-builder-master\asset-builder-
master\node_modules\lodash\index.js:1317:13)
      at Function.forEach (C:\Users\Craig\Downloads\asset-builder-master\asset-b
uilder-master\node_modules\lodash\index.js:5958:11)
      at Context.<anonymous> (C:\Users\Craig\Downloads\asset-builder-master\asse
t-builder-master\test\test.js:316:11)
      at callFn (C:\Users\Craig\Downloads\asset-builder-master\asset-builder-mas
ter\node_modules\mocha\lib\runnable.js:251:21)
      at Test.Runnable.run (C:\Users\Craig\Downloads\asset-builder-master\asset-
builder-master\node_modules\mocha\lib\runnable.js:244:7)
      at Runner.runTest (C:\Users\Craig\Downloads\asset-builder-master\asset-bui
lder-master\node_modules\mocha\lib\runner.js:374:10)
      at C:\Users\Craig\Downloads\asset-builder-master\asset-builder-master\node
_modules\mocha\lib\runner.js:452:12
      at next (C:\Users\Craig\Downloads\asset-builder-master\asset-builder-maste
r\node_modules\mocha\lib\runner.js:299:14)
      at C:\Users\Craig\Downloads\asset-builder-master\asset-builder-master\node
_modules\mocha\lib\runner.js:309:7
      at next (C:\Users\Craig\Downloads\asset-builder-master\asset-builder-maste
r\node_modules\mocha\lib\runner.js:248:23)
      at Immediate._onImmediate (C:\Users\Craig\Downloads\asset-builder-master\a
sset-builder-master\node_modules\mocha\lib\runner.js:276:5)
      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.

2 Likes

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

2 Likes

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:

C:\wamp\www\nces.com.au\wp-content\themes\s
[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?

Duncan

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

Details:
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