madebysource / pho-devstack

Automated workflow for front-end developers in one tasty bowl of code.
http://pho.madebysource.com
961 stars 59 forks source link

Windows - unhandled error on editing js file #26

Open seamc opened 10 years ago

seamc commented 10 years ago

Whenever I edit and save a Javascript file under ~/prj/src/scripts, I receive the error listed below. No further information is provided within the gulp script or the error.

The output below is the same between cygwin and windows command prompt. The error below has occurred on Win7 and Win8 with fresh installs of node.js v0.10.28

$ gulp [gulp] Using gulpfile ~\Code\pho\gulpfile.js [gulp] Starting 'scripts'... [gulp] Starting 'styles'... [gulp] Starting 'images'... [gulp] Finished 'images' after 16 ms [gulp] Finished 'styles' after 125 ms [gulp] Finished 'scripts' after 152 ms [gulp] Starting 'index'... [gulp] Finished 'index' after 91 ms [gulp] Starting 'default'... [gulp] Finished 'default' after 277 ms [gulp] Live reload server listening on: 35729 [gulp] Starting 'scripts'... [gulp] Starting 'styles'... [gulp] Finished 'styles' after 9.59 μs [gulp] Starting 'images'... [gulp] Finished 'images' after 5.59 ms

events.js:72 throw er; // Unhandled 'error' event ^ Error: EPERM, open '~\pho\dist\scripts\main.js'

PavelGavlik commented 10 years ago

Have you checked permissions of main.js? User that runs gulp should be able to read/write main.js.

PavelGavlik commented 10 years ago

OK, my bad. Seems like it doesn't work on Windows properly. I'll look into it.

seamc commented 10 years ago

I have not been able to fully debug the problem, but I ran pho through node-inspector and found that the stack dies after gulp's vinyl-fs's mkdirp attempts a write to \dist\scripts\main.js

mkdirp's call stack is as follows:

            // In the case of any other error, just see if there's a dir
            // there already.  If so, then hooray!  If not, then something
            // is borked.
            default:
                fs.stat(p, function (er2, stat) {
                    // if the stat fails, then that's super weird.
                    // let the original error be the failure reason.
                    if (er2 || !stat.isDirectory()) cb(er, made)
                    else cb(null, made); //  <----- pho callback here
                });
                break;

I will try to investigate more; pho seems like a very cool tool, but I am not the fastest with node debugging.