New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: EPERM #660

Closed
Gazzo100uk opened this Issue Sep 3, 2014 · 55 comments

Comments

Projects
None yet
@Gazzo100uk

I'm getting the following error when running gulp tasks: Error: EPERM, open 'filename....'

Any idea what is causing this or how do I investigate the issue and resolve it?

Regards,
Gary

@contra

This comment has been minimized.

Show comment
Hide comment
@contra

contra Sep 3, 2014

Member

Can you post your gulpfile, OS, version of gulp?

Member

contra commented Sep 3, 2014

Can you post your gulpfile, OS, version of gulp?

@sindresorhus

This comment has been minimized.

Show comment
Hide comment
@sindresorhus

sindresorhus Sep 3, 2014

Contributor

Also include the full terminal output.

Contributor

sindresorhus commented Sep 3, 2014

Also include the full terminal output.

@phated

This comment has been minimized.

Show comment
Hide comment
@phated

phated Sep 4, 2014

Member

Isn't this just a permissions error?

Member

phated commented Sep 4, 2014

Isn't this just a permissions error?

@pkozlowski-opensource

This comment has been minimized.

Show comment
Hide comment
@pkozlowski-opensource

pkozlowski-opensource Sep 4, 2014

Contributor

I saw those errors recently on Windows where a text editor (in this particular case it was Atom) was "locking files" so another node process couldn't delete and even read a given file.

In any case it is hard to help without info that @contra asked for.

Contributor

pkozlowski-opensource commented Sep 4, 2014

I saw those errors recently on Windows where a text editor (in this particular case it was Atom) was "locking files" so another node process couldn't delete and even read a given file.

In any case it is hard to help without info that @contra asked for.

@Gazzo100uk

This comment has been minimized.

Show comment
Hide comment
@Gazzo100uk

Gazzo100uk Sep 16, 2014

Yeah it is a permissions issue. I was using visual studio and TFS and I had my workspace configured with the location set to Server. This meant that everything I checked in was given a read only permission on my PC. Changing this workspace location to Local does not give this behaviour and therefore my gulp tasks run okay.

Thanks for the replies folks.

Yeah it is a permissions issue. I was using visual studio and TFS and I had my workspace configured with the location set to Server. This meant that everything I checked in was given a read only permission on my PC. Changing this workspace location to Local does not give this behaviour and therefore my gulp tasks run okay.

Thanks for the replies folks.

@BrainCrumbz

This comment has been minimized.

Show comment
Hide comment
@BrainCrumbz

BrainCrumbz Oct 13, 2014

Just to mention the we got a similar message when cleaning & compiling again files while Adobe Brackets was open:

Error: EPERM, stat 'some-path-to-a-js-file'

The issue went away when we switched Brackets to open another project directory.

Just to mention the we got a similar message when cleaning & compiling again files while Adobe Brackets was open:

Error: EPERM, stat 'some-path-to-a-js-file'

The issue went away when we switched Brackets to open another project directory.

@feiwaltan

This comment has been minimized.

Show comment
Hide comment
@feiwaltan

feiwaltan Nov 4, 2014

I changed the tfs workspace permission on local machine and it still didn't resolve the issue for me. I'm still getting the same error. It seems that every time that we do a gulp build, where the folder is recreated its created as a read only folder.

version of gulp: CLI version 3.8.9, Local version 3.8.10
os: Win 8.1

Error message:

Starting 'images'...
'html' errored after 1.01 s
Error: EPERM, open
'images' errored after 1.01 s
Error: EPERM, open
Finished 'jshint' after 1.29 s
Finished 'bower' after 2.8 s

Edit: Gulp file content:

var requireDir = require('require-dir');
var dir = requireDir('Build/gulpTask');
var gulp = require('gulp');

gulp.task('default', ['bower', 'javascript', 'less', 'html', 'fonts', 'images', 'cssImages', 'jsSourceMap']);

I changed the tfs workspace permission on local machine and it still didn't resolve the issue for me. I'm still getting the same error. It seems that every time that we do a gulp build, where the folder is recreated its created as a read only folder.

version of gulp: CLI version 3.8.9, Local version 3.8.10
os: Win 8.1

Error message:

Starting 'images'...
'html' errored after 1.01 s
Error: EPERM, open
'images' errored after 1.01 s
Error: EPERM, open
Finished 'jshint' after 1.29 s
Finished 'bower' after 2.8 s

Edit: Gulp file content:

var requireDir = require('require-dir');
var dir = requireDir('Build/gulpTask');
var gulp = require('gulp');

gulp.task('default', ['bower', 'javascript', 'less', 'html', 'fonts', 'images', 'cssImages', 'jsSourceMap']);

@phated

This comment has been minimized.

Show comment
Hide comment
@phated

phated Nov 19, 2014

Member

No one can help on this because no gulpfile is attached. I have a feeling it is a race condition (maybe due to task dependencies). Please give more information or I will need to close this and direct it towards stack overflow. Thanks

Member

phated commented Nov 19, 2014

No one can help on this because no gulpfile is attached. I have a feeling it is a race condition (maybe due to task dependencies). Please give more information or I will need to close this and direct it towards stack overflow. Thanks

@contra

This comment has been minimized.

Show comment
Hide comment
@contra

contra Nov 28, 2014

Member

@havenchyk del != gulp, if you have errors using del open them on del

Member

contra commented Nov 28, 2014

@havenchyk del != gulp, if you have errors using del open them on del

@settysreekanth

This comment has been minimized.

Show comment
Hide comment
@settysreekanth

settysreekanth Dec 24, 2014

I had the same issue. It got resolved after I closed Adobe Brackets editor.

I had the same issue. It got resolved after I closed Adobe Brackets editor.

@sacredobelisk

This comment has been minimized.

Show comment
Hide comment
@sacredobelisk

sacredobelisk Dec 29, 2014

I am getting the following error when I edit main.js multiple times: Error: EPERM, unlink

In main.js if I have require("jquery") in the file then when I save the file 2 or more times then I get an EPERM error. If I don't have require("jquery") then I do not get the error and I can save the file fine and the generated file generates normally.

output

C:\tools\code\Personal\gulptest>gulp test
info: running tasks as profile -> dev_local
[14:45:05] Using gulpfile C:\tools\code\Personal\gulptest\gulpfile.js
[14:45:05] Starting 'watch'...
[14:45:05] Finished 'watch' after 54 ms
[14:45:05] Starting 'test'...
[14:45:05] Finished 'test' after 14 µs

I edited the JS file at this point.

[14:45:11] Starting 'clean-scripts'...
[14:45:11] Finished 'clean-scripts' after 5.78 ms
[14:45:11] Starting 'process-scripts'...
[14:45:16] Finished 'process-scripts' after 5.63 s
[14:45:16] Starting 'scripts'...
[14:45:16] Finished 'scripts' after 17 µs

And again here.

[14:45:19] Starting 'clean-scripts'...
[14:45:19] 'clean-scripts' errored after 109 ms
[14:45:19] Error: EPERM, unlink 'C:\tools\code\Personal\gulptest\www\js\main.js'

C:\tools\code\Personal\gulptest\package.json

{
    "name": "GulpTest",
    "description": "Gulp Test",
    "version": "0.0.1",
    "private": true,
    "author": "sacredobelisk",
    "dependencies": {
        "jquery": "^2.1.1",
        "lodash": "^2.4.1",
        "q": "^1.1.1"
    },
    "devDependencies": {
        "async": "^0.9.0",
        "browserify": "^6.2.0",
        "del": "^0.1.3",
        "glob": "^4.0.6",
        "gulp": "^3.8.9",
        "gulp-util": "^3.0.1",
        "vinyl-source-stream": "^1.0.0"
    },
    "browser": {
        "other": "/tools/code/Personal/gulptest/libs/other.js",
        "jquery": "/tools/code/Personal/gulptest/libs/jquery.js"
    }
}

C:\tools\code\Personal\gulptest\gulpfile.js

var gulp = require("gulp");

require("./gulp/scripts");
require("./gulp/watch");

gulp.task("test", ["scripts", "watch"]);

C:\tools\code\Personal\gulptest\gulp\watch.js

var gulp = require("gulp");
gulp.task("watch", function() {
    gulp.watch(["./scripts/**/*.js"], ["scripts"]);
});

C:\tools\code\Personal\gulptest\gulp\scripts.js

var gulp = require("gulp");
var browserify = require("browserify");
var del = require("del");
var source = require("vinyl-source-stream");
var glob = require("glob");
var async = require("async");
var path = require("path");
var util = require("gulp-util");
gulp.task("clean-scripts", function(cb) {
    del("./www/js", {
        "force": true
    }, cb);
})
gulp.task("process-scripts", ["clean-scripts"], function(cb) {
    var globString = "./scripts/*.js";
    glob(globString, {}, function(er, files) {
        async.each(files, function(file, nextFile) {
            var name = path.basename(file);
            var b = browserify({
                "debug": true
            });
            b.add(file);
            b.bundle()
                .on("error", function(err) {
                    util.log(util.colors.red("Error"), err.message);
                    this.end();
                })
                .pipe(source(name))
                .pipe(gulp.dest("./www/js"))
                .on("end", nextFile);
        }, cb);
    });
});
gulp.task("scripts", ["process-scripts"])

C:\tools\code\Personal\gulptest\scripts\main.js

// If jquery used then after saving file while running "gulp test" will show EPERM error; using other does not
//var $ = require("jquery");
var $ = require("other");

C:\tools\code\Personal\gulptest\libs\jquery.js - I copied the latest 1.x version from jquery.com
C:\tools\code\Personal\gulptest\libs\other.js - single line: console.log("other");

I am getting the following error when I edit main.js multiple times: Error: EPERM, unlink

In main.js if I have require("jquery") in the file then when I save the file 2 or more times then I get an EPERM error. If I don't have require("jquery") then I do not get the error and I can save the file fine and the generated file generates normally.

output

C:\tools\code\Personal\gulptest>gulp test
info: running tasks as profile -> dev_local
[14:45:05] Using gulpfile C:\tools\code\Personal\gulptest\gulpfile.js
[14:45:05] Starting 'watch'...
[14:45:05] Finished 'watch' after 54 ms
[14:45:05] Starting 'test'...
[14:45:05] Finished 'test' after 14 µs

I edited the JS file at this point.

[14:45:11] Starting 'clean-scripts'...
[14:45:11] Finished 'clean-scripts' after 5.78 ms
[14:45:11] Starting 'process-scripts'...
[14:45:16] Finished 'process-scripts' after 5.63 s
[14:45:16] Starting 'scripts'...
[14:45:16] Finished 'scripts' after 17 µs

And again here.

[14:45:19] Starting 'clean-scripts'...
[14:45:19] 'clean-scripts' errored after 109 ms
[14:45:19] Error: EPERM, unlink 'C:\tools\code\Personal\gulptest\www\js\main.js'

C:\tools\code\Personal\gulptest\package.json

{
    "name": "GulpTest",
    "description": "Gulp Test",
    "version": "0.0.1",
    "private": true,
    "author": "sacredobelisk",
    "dependencies": {
        "jquery": "^2.1.1",
        "lodash": "^2.4.1",
        "q": "^1.1.1"
    },
    "devDependencies": {
        "async": "^0.9.0",
        "browserify": "^6.2.0",
        "del": "^0.1.3",
        "glob": "^4.0.6",
        "gulp": "^3.8.9",
        "gulp-util": "^3.0.1",
        "vinyl-source-stream": "^1.0.0"
    },
    "browser": {
        "other": "/tools/code/Personal/gulptest/libs/other.js",
        "jquery": "/tools/code/Personal/gulptest/libs/jquery.js"
    }
}

C:\tools\code\Personal\gulptest\gulpfile.js

var gulp = require("gulp");

require("./gulp/scripts");
require("./gulp/watch");

gulp.task("test", ["scripts", "watch"]);

C:\tools\code\Personal\gulptest\gulp\watch.js

var gulp = require("gulp");
gulp.task("watch", function() {
    gulp.watch(["./scripts/**/*.js"], ["scripts"]);
});

C:\tools\code\Personal\gulptest\gulp\scripts.js

var gulp = require("gulp");
var browserify = require("browserify");
var del = require("del");
var source = require("vinyl-source-stream");
var glob = require("glob");
var async = require("async");
var path = require("path");
var util = require("gulp-util");
gulp.task("clean-scripts", function(cb) {
    del("./www/js", {
        "force": true
    }, cb);
})
gulp.task("process-scripts", ["clean-scripts"], function(cb) {
    var globString = "./scripts/*.js";
    glob(globString, {}, function(er, files) {
        async.each(files, function(file, nextFile) {
            var name = path.basename(file);
            var b = browserify({
                "debug": true
            });
            b.add(file);
            b.bundle()
                .on("error", function(err) {
                    util.log(util.colors.red("Error"), err.message);
                    this.end();
                })
                .pipe(source(name))
                .pipe(gulp.dest("./www/js"))
                .on("end", nextFile);
        }, cb);
    });
});
gulp.task("scripts", ["process-scripts"])

C:\tools\code\Personal\gulptest\scripts\main.js

// If jquery used then after saving file while running "gulp test" will show EPERM error; using other does not
//var $ = require("jquery");
var $ = require("other");

C:\tools\code\Personal\gulptest\libs\jquery.js - I copied the latest 1.x version from jquery.com
C:\tools\code\Personal\gulptest\libs\other.js - single line: console.log("other");

@contra

This comment has been minimized.

Show comment
Hide comment
@contra

contra Dec 29, 2014

Member

For everyone here: make sure the file permissions are correct on the folder and files you are trying to edit, make sure you do not have a crappy antivirus running that is locking files, make sure you are not using an editor that is locking the file or folders. Kill everything that is running on your computer except gulp to make sure something isn't locking the folders. There is no reason gulp would be putting these errors out, we just use the standard fs.writeFile in node to write stuff. It is something with your environment that is causing this.

Member

contra commented Dec 29, 2014

For everyone here: make sure the file permissions are correct on the folder and files you are trying to edit, make sure you do not have a crappy antivirus running that is locking files, make sure you are not using an editor that is locking the file or folders. Kill everything that is running on your computer except gulp to make sure something isn't locking the folders. There is no reason gulp would be putting these errors out, we just use the standard fs.writeFile in node to write stuff. It is something with your environment that is causing this.

@contra contra closed this Dec 29, 2014

@sacredobelisk

This comment has been minimized.

Show comment
Hide comment
@sacredobelisk

sacredobelisk Dec 29, 2014

I've tried all that before posting here. File permissions have been set to "everyone" with full access. I don't have any AVS installed. I used Scite to edit the file. Scite is just a glorified colorized text editor. Nothing else is running except the CMD prompt and Scite when I make the JS changes.

And it's weird cause the first edit of the file works fine. Any subsequent edits fail.

I've tried all that before posting here. File permissions have been set to "everyone" with full access. I don't have any AVS installed. I used Scite to edit the file. Scite is just a glorified colorized text editor. Nothing else is running except the CMD prompt and Scite when I make the JS changes.

And it's weird cause the first edit of the file works fine. Any subsequent edits fail.

@contra

This comment has been minimized.

Show comment
Hide comment
@contra

contra Dec 29, 2014

Member

@sacredobelisk Close Scite too

Member

contra commented Dec 29, 2014

@sacredobelisk Close Scite too

@sacredobelisk

This comment has been minimized.

Show comment
Hide comment
@sacredobelisk

sacredobelisk Dec 29, 2014

Alright, edited the file in notepad then. Still same issue. I'm just going to try starting from scratch to see if that helps.

Should note that the file that has the eperm error is the generated file. Not the one that's currently being edited.

Alright, edited the file in notepad then. Still same issue. I'm just going to try starting from scratch to see if that helps.

Should note that the file that has the eperm error is the generated file. Not the one that's currently being edited.

@settysreekanth

This comment has been minimized.

Show comment
Hide comment
@settysreekanth

settysreekanth Dec 29, 2014

@sacredobelisk, Delete that generated file and then gulp it again.. This should work.

@sacredobelisk, Delete that generated file and then gulp it again.. This should work.

@sacredobelisk

This comment has been minimized.

Show comment
Hide comment
@sacredobelisk

sacredobelisk Dec 30, 2014

Did a fresh install. Still getting same error.

@settysreekanth Deleted the file. Tried to edit the file again and no luck. Restarting gulp regenerates the file with the changes but I thought the watch task was to avoid running gulp anytime I edit a JS/CSS file.

Did a fresh install. Still getting same error.

@settysreekanth Deleted the file. Tried to edit the file again and no luck. Restarting gulp regenerates the file with the changes but I thought the watch task was to avoid running gulp anytime I edit a JS/CSS file.

@contra

This comment has been minimized.

Show comment
Hide comment
@contra

contra Dec 30, 2014

Member

What are the permissions of the input files? gulp will write the output with the same permissions as the input

Member

contra commented Dec 30, 2014

What are the permissions of the input files? gulp will write the output with the same permissions as the input

@sacredobelisk

This comment has been minimized.

Show comment
Hide comment
@sacredobelisk

sacredobelisk Dec 30, 2014

Permissions should be all my user (who is an administrator).

Playing around with making a test project with the configuration above yielded me a working example. I started dropping in code from my work's project into the test project and that's when I saw that the JS file I was editing had this line: var $ = window.$ = window.jQuery = require('jquery');

If I comment out that line I do not get the error. If uncommented, then the error shows up.

That's as far as I got but it's a little late right now and have to be up early so signing off for now.

Permissions should be all my user (who is an administrator).

Playing around with making a test project with the configuration above yielded me a working example. I started dropping in code from my work's project into the test project and that's when I saw that the JS file I was editing had this line: var $ = window.$ = window.jQuery = require('jquery');

If I comment out that line I do not get the error. If uncommented, then the error shows up.

That's as far as I got but it's a little late right now and have to be up early so signing off for now.

@contra

This comment has been minimized.

Show comment
Hide comment
@contra

contra Dec 30, 2014

Member

@sacredobelisk So the files for the jquery module are not right? Did you sudo npm install jquery or something?

Member

contra commented Dec 30, 2014

@sacredobelisk So the files for the jquery module are not right? Did you sudo npm install jquery or something?

@sacredobelisk

This comment has been minimized.

Show comment
Hide comment
@sacredobelisk

sacredobelisk Dec 31, 2014

I just created a new file and copied the contents from jquery.com in chrome.

I updated my first comment with the code as it stands now. I tried removing as much as possible to narrow down where my issue is coming from.

I can reproduce this consistently now in my surface pro 3 (Win 8.1) and my desktop (Win 7).

I just created a new file and copied the contents from jquery.com in chrome.

I updated my first comment with the code as it stands now. I tried removing as much as possible to narrow down where my issue is coming from.

I can reproduce this consistently now in my surface pro 3 (Win 8.1) and my desktop (Win 7).

@contra

This comment has been minimized.

Show comment
Hide comment
@contra

contra Dec 31, 2014

Member

@sacredobelisk Can you make a git repo of the barebones needed to reproduce this issue so we can isolate this

Member

contra commented Dec 31, 2014

@sacredobelisk Can you make a git repo of the barebones needed to reproduce this issue so we can isolate this

@sacredobelisk

This comment has been minimized.

Show comment
Hide comment
@sacredobelisk

This comment has been minimized.

Show comment
Hide comment
@sacredobelisk

sacredobelisk Jan 6, 2015

Anyone else have any luck being able to reproduce this? Or found a solution that I haven't had luck finding?

Anyone else have any luck being able to reproduce this? Or found a solution that I haven't had luck finding?

@schleumer

This comment has been minimized.

Show comment
Hide comment
@schleumer

schleumer Jan 8, 2015

I got the same problem and possible sources. When I found the same problem the first first thing I did was check which files gulp was hanging on(lsof) and, bang, there was the file which del couldn't clean.

First possible source: browserify keep files opened so del can't clean the directory;
Second possible source: vinyl-source-stream keep files opened so del can't clean the directory;
Third possible source: gulp.dest keep files opened after write so del can't clean the directory;
Fourth possible source: while gulp-watch watches files it keep somehow the file opened so del can't clean the directory;

But i think it's more Browserify or Vinyl problem than gulp itself.

My OS at moment is Windows 8.1, also tested in OS X Yosemite and ArchLinux. File permissions are ok and triple checked.

It's my gulpfile https://gist.github.com/schleumer/9e07d040d1a773511405 of course it's not complete, i just removed useless tasks which is not related.

I got the same problem and possible sources. When I found the same problem the first first thing I did was check which files gulp was hanging on(lsof) and, bang, there was the file which del couldn't clean.

First possible source: browserify keep files opened so del can't clean the directory;
Second possible source: vinyl-source-stream keep files opened so del can't clean the directory;
Third possible source: gulp.dest keep files opened after write so del can't clean the directory;
Fourth possible source: while gulp-watch watches files it keep somehow the file opened so del can't clean the directory;

But i think it's more Browserify or Vinyl problem than gulp itself.

My OS at moment is Windows 8.1, also tested in OS X Yosemite and ArchLinux. File permissions are ok and triple checked.

It's my gulpfile https://gist.github.com/schleumer/9e07d040d1a773511405 of course it's not complete, i just removed useless tasks which is not related.

@contra

This comment has been minimized.

Show comment
Hide comment
@contra

contra Jan 8, 2015

Member

@schleumer Nothing but browserify, gulp-watch, and gulp.dest actually touch the file system they just deal with the in-memory files. gulp.dest just uses fs.writeFile to write a file so it isn't that keeping it open.

Member

contra commented Jan 8, 2015

@schleumer Nothing but browserify, gulp-watch, and gulp.dest actually touch the file system they just deal with the in-memory files. gulp.dest just uses fs.writeFile to write a file so it isn't that keeping it open.

@contra

This comment has been minimized.

Show comment
Hide comment
@contra

contra Jan 8, 2015

Member

@sacredobelisk I downloaded your test repo and I am able to reproduce an ENOENT error which is different from your EPERM issue, but the bug is from browserify not from gulp. You installed the browserify module, created a bundle, and then the bundle throws an error. This has nothing to do with gulp, so the issue should be opened on browserify or you should check if there already is one. You should completely remove gulp from the equation when opening that issue so it is easier for them to reproduce and diagnose it.

Member

contra commented Jan 8, 2015

@sacredobelisk I downloaded your test repo and I am able to reproduce an ENOENT error which is different from your EPERM issue, but the bug is from browserify not from gulp. You installed the browserify module, created a bundle, and then the bundle throws an error. This has nothing to do with gulp, so the issue should be opened on browserify or you should check if there already is one. You should completely remove gulp from the equation when opening that issue so it is easier for them to reproduce and diagnose it.

@schleumer

This comment has been minimized.

Show comment
Hide comment
@schleumer

schleumer Jan 8, 2015

Thanks, @contra! I'll move my issue to Browserify and gulp-watch, because gulp-watch already have some issues like mine and this don't happen only with Browserify, kinda weird. Thanks again, sorry for the mess.

Thanks, @contra! I'll move my issue to Browserify and gulp-watch, because gulp-watch already have some issues like mine and this don't happen only with Browserify, kinda weird. Thanks again, sorry for the mess.

@sacredobelisk

This comment has been minimized.

Show comment
Hide comment
@sacredobelisk

sacredobelisk Jan 10, 2015

Will do. Thanks, @contra!

Will do. Thanks, @contra!

@keberox

This comment has been minimized.

Show comment
Hide comment
@keberox

keberox May 21, 2015

Just for whatever is worth to mention, I was having the EPERM error, what rang a bell was what @contra mentioned about gulp using the same permissions from the input file to write the output file, in my case I am sadly stuck with Clear Case for source control, and it is a pain to work with, all files that are read in a "non-checked out" state will end up being written as read only and next time the build runs, it errors out, my solution: try to check out all files before running the build tasks.

This may be a totally different problem from what everybody else is having, but just wanted to confirm on the statement of how gulp handles file permissions.

keberox commented May 21, 2015

Just for whatever is worth to mention, I was having the EPERM error, what rang a bell was what @contra mentioned about gulp using the same permissions from the input file to write the output file, in my case I am sadly stuck with Clear Case for source control, and it is a pain to work with, all files that are read in a "non-checked out" state will end up being written as read only and next time the build runs, it errors out, my solution: try to check out all files before running the build tasks.

This may be a totally different problem from what everybody else is having, but just wanted to confirm on the statement of how gulp handles file permissions.

@nover

This comment has been minimized.

Show comment
Hide comment
@nover

nover Jun 12, 2015

I'm writing this as it goes in thread with what @keberox is mentioning. I'm currently working for a client who is using Microsoft TFS 2013 (sigh). Sadly TFS is exhibiting the same behavior as "Clear Case". If files are not "checked out for editing" they will have a read-only flag set. Thus, the first gulp works fine, but subsequent runs fails with EPERM, Open errors. Bower and other tools are having similar issues. The only solution so far for me is to "check out" the entire project with gulp / bower dependencies, which kinda suck.

Is it possible to get gulp to NOT set the read-only flags on the output files, or is this overly complex? :)

nover commented Jun 12, 2015

I'm writing this as it goes in thread with what @keberox is mentioning. I'm currently working for a client who is using Microsoft TFS 2013 (sigh). Sadly TFS is exhibiting the same behavior as "Clear Case". If files are not "checked out for editing" they will have a read-only flag set. Thus, the first gulp works fine, but subsequent runs fails with EPERM, Open errors. Bower and other tools are having similar issues. The only solution so far for me is to "check out" the entire project with gulp / bower dependencies, which kinda suck.

Is it possible to get gulp to NOT set the read-only flags on the output files, or is this overly complex? :)

@feiwaltan

This comment has been minimized.

Show comment
Hide comment
@feiwaltan

feiwaltan Jun 12, 2015

@nover
Currently I am also using TFS 2013 but no longer encounter the issue with gulp EPERM error.

We resolved this by making the tfs workspace local, this also allows us to work offline if tfs goes down and we haven't had any issues with merging changes.

Reference to configure: https://msdn.microsoft.com/en-us/library/gg490753(v=vs.100).aspx

@nover
Currently I am also using TFS 2013 but no longer encounter the issue with gulp EPERM error.

We resolved this by making the tfs workspace local, this also allows us to work offline if tfs goes down and we haven't had any issues with merging changes.

Reference to configure: https://msdn.microsoft.com/en-us/library/gg490753(v=vs.100).aspx

@KE-Cbu

This comment has been minimized.

Show comment
Hide comment
@KE-Cbu

KE-Cbu Jun 19, 2015

I got the same problem.. With TFS 2013. I change my workspace from server to local and it solves this point.

KE-Cbu commented Jun 19, 2015

I got the same problem.. With TFS 2013. I change my workspace from server to local and it solves this point.

@mvarblow

This comment has been minimized.

Show comment
Hide comment
@mvarblow

mvarblow Sep 3, 2015

I have the same problem with TFS, but don't have the option to use a local workspace due to the size of our solution. Is it possible to get gulp to NOT set the read-only flags on the output files?

mvarblow commented Sep 3, 2015

I have the same problem with TFS, but don't have the option to use a local workspace due to the size of our solution. Is it possible to get gulp to NOT set the read-only flags on the output files?

@feiwaltan

This comment has been minimized.

Show comment
Hide comment
@feiwaltan

feiwaltan Sep 4, 2015

@mvarblow There's a way to create a gulp task that would allow you to update the file permission from read to write, but that would be problematic when you check stuff back in, might have merge conflicts on each checkin.

Here is a library that will assist with that: https://www.npmjs.com/package/gulp-chmod

@mvarblow There's a way to create a gulp task that would allow you to update the file permission from read to write, but that would be problematic when you check stuff back in, might have merge conflicts on each checkin.

Here is a library that will assist with that: https://www.npmjs.com/package/gulp-chmod

@EjaYF

This comment has been minimized.

Show comment
Hide comment
@EjaYF

EjaYF Jan 11, 2016

Thanks @feiwaltan for sharing this. I use gulp in VS2015 for copying from /js to /jsdest which is the folder from where I am referencing the scripts in my browser. I only edit the /js files, so no problems with local workspace or TFS issues for me :)

EjaYF commented Jan 11, 2016

Thanks @feiwaltan for sharing this. I use gulp in VS2015 for copying from /js to /jsdest which is the folder from where I am referencing the scripts in my browser. I only edit the /js files, so no problems with local workspace or TFS issues for me :)

@8raveStarr

This comment has been minimized.

Show comment
Hide comment
@8raveStarr

8raveStarr Jan 29, 2016

@EjaYF How did you include your /jsdest folder in the project so it would publish that content, but not include it in source control/TFS? I have tried to select the files and use the Files > Source Control > Advanced > Exclude File from Source Control, but that still sets a read-only property on the file. That then causes issues with Gulp.

@EjaYF How did you include your /jsdest folder in the project so it would publish that content, but not include it in source control/TFS? I have tried to select the files and use the Files > Source Control > Advanced > Exclude File from Source Control, but that still sets a read-only property on the file. That then causes issues with Gulp.

@EjaYF

This comment has been minimized.

Show comment
Hide comment
@EjaYF

EjaYF Feb 1, 2016

@8raveStarr I think your solution is fine. Make sure the file is not readonly. And use
.pipe(chmod(755))
I guess from that moment you won't have read-only attributes anymore...

EjaYF commented Feb 1, 2016

@8raveStarr I think your solution is fine. Make sure the file is not readonly. And use
.pipe(chmod(755))
I guess from that moment you won't have read-only attributes anymore...

@EjaYF

This comment has been minimized.

Show comment
Hide comment
@EjaYF

EjaYF Feb 8, 2016

@8raveStarr I was facing the exact problem as you did now... This helped me: http://stackoverflow.com/questions/29483772/remove-windows-file-readonly-attribute-in-gulp-file

The solution is to remove the readonly attribute beforehand:

require("child_process").exec("attrib -r <dir-name>\*.* /s");

EjaYF commented Feb 8, 2016

@8raveStarr I was facing the exact problem as you did now... This helped me: http://stackoverflow.com/questions/29483772/remove-windows-file-readonly-attribute-in-gulp-file

The solution is to remove the readonly attribute beforehand:

require("child_process").exec("attrib -r <dir-name>\*.* /s");

@yogeshnikam

This comment has been minimized.

Show comment
Hide comment
@yogeshnikam

yogeshnikam Jul 29, 2016

I have one problem related to setting the permission for js file, I am using gulp for combining multiple files into one. For that's what i am doing i am setting permission for the compiled file. Using gulp-chmod package, so that I can set the permission for the files,
Suppose i set write:false and run gulp it will set the file read only, but at the time of again removing the permission I am going to set write:true but that time I am getting the error. EPERM: Operation not permitted, this is because of that read-only property true for the compiled file. If i manually remove the read-only property and run gulp again it will resolve. But I want to remove that property using gulp if i set the option write: true still i am getting error, is there another way to resolve the issue.

I have one problem related to setting the permission for js file, I am using gulp for combining multiple files into one. For that's what i am doing i am setting permission for the compiled file. Using gulp-chmod package, so that I can set the permission for the files,
Suppose i set write:false and run gulp it will set the file read only, but at the time of again removing the permission I am going to set write:true but that time I am getting the error. EPERM: Operation not permitted, this is because of that read-only property true for the compiled file. If i manually remove the read-only property and run gulp again it will resolve. But I want to remove that property using gulp if i set the option write: true still i am getting error, is there another way to resolve the issue.

@golddragon007

This comment has been minimized.

Show comment
Hide comment
@golddragon007

golddragon007 Aug 9, 2016

Actually I have simmilar problem... Actually I start the watch task, once it compile from less to css, than when it's start the real watch, it's dies.
Console:
[23:03:47] Using gulpfile /mnt/d/phptest/[...]/gulpfile.js
[23:03:47] Starting 'less'...
[23:03:49] Finished 'less' after 1.83 s
[23:03:49] Starting 'default'...
[23:03:49] 'default' errored after 13 ms
[23:03:49] Error: watch /mnt/d/phptest/[...]/less/ EPERM
at exports._errnoException (util.js:1012:11)
at FSWatcher.start (fs.js:1429:19)
at Object.fs.watch (fs.js:1456:11)
at Gaze._watchDir (/mnt/d/phptest/[...]/node_modules/gaze/lib/gaze.js:289:30)
at /mnt/d/phptest/[...]/node_modules/gaze/lib/gaze.js:358:10
at iterate (/mnt/d/phptest/[...]/node_modules/gaze/lib/helper.js:52:5)
at Object.forEachSeries (/mnt/d/phptest/[...]/node_modules/gaze/lib/helper.js:66:3)
at Gaze._initWatched (/mnt/d/phptest/[...]/node_modules/gaze/lib/gaze.js:354:10)
at Gaze.add (/mnt/d/phptest/[...]/node_modules/gaze/lib/gaze.js:177:8)
at new Gaze (/mnt/d/phptest/[...]/node_modules/gaze/lib/gaze.js:74:10)

gulpfile.js
/*global -$ */
'use strict';
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var less = require('gulp-less');

// Error notifications
var reportError = function(error) {
$.notify({
title: 'Gulp Task Error',
message: 'Check the console.'
}).write(error);
console.log(error.toString());
this.emit('end');
}

// less processing
gulp.task('less', function() {
return gulp.src('less/style.less')
.pipe($.sourcemaps.init())
// Convert less into css
.pipe($.less({
outputStyle: 'nested', // libless doesn't support expanded yet
precision: 10
}))
// Show errors
.on('error', reportError)
// Autoprefix properties
.pipe($.autoprefixer({
browsers: ['last 2 versions']
}))
// Write sourcemaps
.pipe($.sourcemaps.write())
// Save css
.pipe(gulp.dest('css'));
});

// process JS files and return the stream.
gulp.task('js', function () {
return gulp.src('js/*.js')
.pipe(gulp.dest('js'));
});

// Optimize Images
gulp.task('images', function() {
return gulp.src('img/*')
.pipe($.imagemin({
progressive: true,
interlaced: true,
svgoPlugins: [{
cleanupIDs: false
}]
}))
.pipe(gulp.dest('img'));
});

// JS hint
gulp.task('jshint', function() {
return gulp.src('js/*.js')
.pipe($.jshint())
.pipe($.jshint.reporter('jshint-stylish'))
.pipe($.notify({
title: "JS Hint",
message: "JS Hint says all is good.",
onLast: true
}));
});

// Beautify JS
gulp.task('beautify', function() {
gulp.src('js/*.js')
.pipe($.beautify({indentSize: 2}))
.pipe(gulp.dest('js'))
.pipe($.notify({
title: "JS Beautified",
message: "JS files in the theme have been beautified.",
onLast: true
}));
});

// Compress JS
gulp.task('compress', function() {
return gulp.src('js/*.js')
.pipe($.sourcemaps.init())
.pipe($.uglify())
.pipe($.sourcemaps.write())
.pipe(gulp.dest('js'))
.pipe($.notify({
title: "JS Minified",
message: "JS files in the theme have been minified.",
onLast: true
}));
});

// Run drush to clear the theme registry
gulp.task('drush', function() {
return gulp.src('', {
read: false
})
.pipe($.shell([
'drush cc css-js',
]))
.pipe($.notify({
title: "Caches cleared",
message: "Drupal CSS/JS caches cleared.",
onLast: true
}));
});

// Default task to be run with gulp
gulp.task('default', ['less'], function() {
gulp.watch("less/.less", ['less']);
gulp.watch("js/
.js", ['js']);
});

OS: windwos 10, script running from bash on windows console, also, it was installed the linux version of everything. All files are set to anybody can read/write/execute from linux console, and in window permission, the administrator, user, anybody roles has full (complette) permission (read/write/execute/etc).

Anybody?

Actually I have simmilar problem... Actually I start the watch task, once it compile from less to css, than when it's start the real watch, it's dies.
Console:
[23:03:47] Using gulpfile /mnt/d/phptest/[...]/gulpfile.js
[23:03:47] Starting 'less'...
[23:03:49] Finished 'less' after 1.83 s
[23:03:49] Starting 'default'...
[23:03:49] 'default' errored after 13 ms
[23:03:49] Error: watch /mnt/d/phptest/[...]/less/ EPERM
at exports._errnoException (util.js:1012:11)
at FSWatcher.start (fs.js:1429:19)
at Object.fs.watch (fs.js:1456:11)
at Gaze._watchDir (/mnt/d/phptest/[...]/node_modules/gaze/lib/gaze.js:289:30)
at /mnt/d/phptest/[...]/node_modules/gaze/lib/gaze.js:358:10
at iterate (/mnt/d/phptest/[...]/node_modules/gaze/lib/helper.js:52:5)
at Object.forEachSeries (/mnt/d/phptest/[...]/node_modules/gaze/lib/helper.js:66:3)
at Gaze._initWatched (/mnt/d/phptest/[...]/node_modules/gaze/lib/gaze.js:354:10)
at Gaze.add (/mnt/d/phptest/[...]/node_modules/gaze/lib/gaze.js:177:8)
at new Gaze (/mnt/d/phptest/[...]/node_modules/gaze/lib/gaze.js:74:10)

gulpfile.js
/*global -$ */
'use strict';
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var less = require('gulp-less');

// Error notifications
var reportError = function(error) {
$.notify({
title: 'Gulp Task Error',
message: 'Check the console.'
}).write(error);
console.log(error.toString());
this.emit('end');
}

// less processing
gulp.task('less', function() {
return gulp.src('less/style.less')
.pipe($.sourcemaps.init())
// Convert less into css
.pipe($.less({
outputStyle: 'nested', // libless doesn't support expanded yet
precision: 10
}))
// Show errors
.on('error', reportError)
// Autoprefix properties
.pipe($.autoprefixer({
browsers: ['last 2 versions']
}))
// Write sourcemaps
.pipe($.sourcemaps.write())
// Save css
.pipe(gulp.dest('css'));
});

// process JS files and return the stream.
gulp.task('js', function () {
return gulp.src('js/*.js')
.pipe(gulp.dest('js'));
});

// Optimize Images
gulp.task('images', function() {
return gulp.src('img/*')
.pipe($.imagemin({
progressive: true,
interlaced: true,
svgoPlugins: [{
cleanupIDs: false
}]
}))
.pipe(gulp.dest('img'));
});

// JS hint
gulp.task('jshint', function() {
return gulp.src('js/*.js')
.pipe($.jshint())
.pipe($.jshint.reporter('jshint-stylish'))
.pipe($.notify({
title: "JS Hint",
message: "JS Hint says all is good.",
onLast: true
}));
});

// Beautify JS
gulp.task('beautify', function() {
gulp.src('js/*.js')
.pipe($.beautify({indentSize: 2}))
.pipe(gulp.dest('js'))
.pipe($.notify({
title: "JS Beautified",
message: "JS files in the theme have been beautified.",
onLast: true
}));
});

// Compress JS
gulp.task('compress', function() {
return gulp.src('js/*.js')
.pipe($.sourcemaps.init())
.pipe($.uglify())
.pipe($.sourcemaps.write())
.pipe(gulp.dest('js'))
.pipe($.notify({
title: "JS Minified",
message: "JS files in the theme have been minified.",
onLast: true
}));
});

// Run drush to clear the theme registry
gulp.task('drush', function() {
return gulp.src('', {
read: false
})
.pipe($.shell([
'drush cc css-js',
]))
.pipe($.notify({
title: "Caches cleared",
message: "Drupal CSS/JS caches cleared.",
onLast: true
}));
});

// Default task to be run with gulp
gulp.task('default', ['less'], function() {
gulp.watch("less/.less", ['less']);
gulp.watch("js/
.js", ['js']);
});

OS: windwos 10, script running from bash on windows console, also, it was installed the linux version of everything. All files are set to anybody can read/write/execute from linux console, and in window permission, the administrator, user, anybody roles has full (complette) permission (read/write/execute/etc).

Anybody?

@andrewfluck

This comment has been minimized.

Show comment
Hide comment
@andrewfluck

andrewfluck Aug 16, 2016

I'm getting the same exact issue

I'm getting the same exact issue

@cocoademon

This comment has been minimized.

Show comment
Hide comment
@cocoademon

cocoademon Aug 18, 2016

Hello all, I had the same issue on Windows with Browserify/Babelify.

I resolved it by adding the buffer stage to the pipeline, ie changing:

return bundler
        .bundle()
        .on('error', gutil.log.bind(gutil, 'Browserify Error'))
        .pipe(source('content/js/main.js'))
        .pipe(gulp.dest('build'));

to:

var buffer = require('vinyl-buffer');

...

return bundler
        .bundle()
        .on('error', gutil.log.bind(gutil, 'Browserify Error'))
        .pipe(source('content/js/main.js'))
        .pipe(buffer())
        .pipe(gulp.dest('build'));

I haven't investigated why this is so important yet.

cocoademon commented Aug 18, 2016

Hello all, I had the same issue on Windows with Browserify/Babelify.

I resolved it by adding the buffer stage to the pipeline, ie changing:

return bundler
        .bundle()
        .on('error', gutil.log.bind(gutil, 'Browserify Error'))
        .pipe(source('content/js/main.js'))
        .pipe(gulp.dest('build'));

to:

var buffer = require('vinyl-buffer');

...

return bundler
        .bundle()
        .on('error', gutil.log.bind(gutil, 'Browserify Error'))
        .pipe(source('content/js/main.js'))
        .pipe(buffer())
        .pipe(gulp.dest('build'));

I haven't investigated why this is so important yet.

@andrewfluck

This comment has been minimized.

Show comment
Hide comment
@andrewfluck

andrewfluck Aug 18, 2016

I will definitely add that to mile gulpfile

I will definitely add that to mile gulpfile

@andrewfluck

This comment has been minimized.

Show comment
Hide comment

My**

@golddragon007

This comment has been minimized.

Show comment
Hide comment
@golddragon007

golddragon007 Aug 18, 2016

I've put before every .pipe(gulp.dest(*)) the .pipe(buffer()) line, and still I get the same error. I think there's something error in the watch... because the stand alone less task works.

I've put before every .pipe(gulp.dest(*)) the .pipe(buffer()) line, and still I get the same error. I think there's something error in the watch... because the stand alone less task works.

@edson-

This comment has been minimized.

Show comment
Hide comment
@edson-

edson- Sep 27, 2016

We resolved this by giving read/write permissions to the Node application directory/node_modules directory. Node uses its own node_modules directory to install packages during gulp processing.

One developer had read only permissions for anything in the Program Files directory, due to accidentally getting a non-developer image from IT.

Another way to avoid this might be to install Node elsewhere - the root drive, for example.

edson- commented Sep 27, 2016

We resolved this by giving read/write permissions to the Node application directory/node_modules directory. Node uses its own node_modules directory to install packages during gulp processing.

One developer had read only permissions for anything in the Program Files directory, due to accidentally getting a non-developer image from IT.

Another way to avoid this might be to install Node elsewhere - the root drive, for example.

@tegmos

This comment has been minimized.

Show comment
Hide comment
@tegmos

tegmos Oct 3, 2016

After a couple hours of flailing about trying to fix this, finally found @cocoademon solution and it worked for me. Same issue with Vinyl/Browserify.

tegmos commented Oct 3, 2016

After a couple hours of flailing about trying to fix this, finally found @cocoademon solution and it worked for me. Same issue with Vinyl/Browserify.

@chantmich

This comment has been minimized.

Show comment
Hide comment
@chantmich

chantmich Nov 25, 2016

I've had that error while using gulp and realized that atom still had the old version of the file opened after I pulled from github.

All I had to do was close Atom and run gulp again.

Voila! no more error.

I've had that error while using gulp and realized that atom still had the old version of the file opened after I pulled from github.

All I had to do was close Atom and run gulp again.

Voila! no more error.

@pestbarn

This comment has been minimized.

Show comment
Hide comment
@pestbarn

pestbarn Nov 29, 2016

Also having issues with EPERM, but only on my watch task. All tasks run fine except for this one.

Simplified gulpfile:

var gulp             = require('gulp');
var postcss          = require('gulp-postcss');
var postcss_cssnext  = require('postcss-cssnext');
var precss           = require('precss');
var postcss_magician = require('postcss-font-magician');
var clean_css        = require('gulp-clean-css');
var concat_css       = require('gulp-concat-css');
var automath         = require('postcss-automath');
var vfs              = require('vinyl-fs');
var livereload       = require('gulp-livereload');
var pump             = require('pump');

var paths = {
    css: {
        base:       './src/postcss/**/*.postcss',
        normalize:  './node_modules/normalize.css/normalize.css'
    }
};

const css = Object.keys(paths.css).map(key => paths.css[key]);

var processors = [
    postcss_cssnext,
    precss,
    postcss_magician,
    automath
];

gulp.task('css', function(callback){
    pump([
        vfs.src([css[1],css[0]]),
        postcss(processors),
        concat_css('main.min.css'),
        clean_css(),
        vfs.dest('./bin/css/'),
        livereload()
    ], callback);
});

gulp.task('watch', function() {
    livereload.listen();
    gulp.watch(css[0], ['css']);
});

Complete error message:

root@PESTBARN-PC:/mnt/f/www/v2# gulp watch
[20:24:06] Using gulpfile /mnt/f/www/v2/gulpfile.js
[20:24:06] Starting 'watch'...
[20:24:06] 'watch' errored after 27 ms
[20:24:06] Error: watch /mnt/f/www/v2/src/postcss/ EPERM
    at exports._errnoException (util.js:1026:11)
    at FSWatcher.start (fs.js:1429:19)
    at Object.fs.watch (fs.js:1456:11)
    at Gaze._watchDir (/mnt/f/www/v2/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:289:30)
    at /mnt/f/www/v2/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:358:10
    at iterate (/mnt/f/www/v2/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/helper.js:52:5)
    at Object.forEachSeries (/mnt/f/www/v2/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/helper.js:66:3)
    at Gaze._initWatched (/mnt/f/www/v2/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:354:10)
    at Gaze.add (/mnt/f/www/v2/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:177:8)
    at new Gaze (/mnt/f/www/v2/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:74:10)

This error only occurs when running on Windows (Bash). On a Unix system, it works completely fine. Also, I've checked the permissions for every file and folder in the project, which are all rwxrwxrwx.

Also having issues with EPERM, but only on my watch task. All tasks run fine except for this one.

Simplified gulpfile:

var gulp             = require('gulp');
var postcss          = require('gulp-postcss');
var postcss_cssnext  = require('postcss-cssnext');
var precss           = require('precss');
var postcss_magician = require('postcss-font-magician');
var clean_css        = require('gulp-clean-css');
var concat_css       = require('gulp-concat-css');
var automath         = require('postcss-automath');
var vfs              = require('vinyl-fs');
var livereload       = require('gulp-livereload');
var pump             = require('pump');

var paths = {
    css: {
        base:       './src/postcss/**/*.postcss',
        normalize:  './node_modules/normalize.css/normalize.css'
    }
};

const css = Object.keys(paths.css).map(key => paths.css[key]);

var processors = [
    postcss_cssnext,
    precss,
    postcss_magician,
    automath
];

gulp.task('css', function(callback){
    pump([
        vfs.src([css[1],css[0]]),
        postcss(processors),
        concat_css('main.min.css'),
        clean_css(),
        vfs.dest('./bin/css/'),
        livereload()
    ], callback);
});

gulp.task('watch', function() {
    livereload.listen();
    gulp.watch(css[0], ['css']);
});

Complete error message:

root@PESTBARN-PC:/mnt/f/www/v2# gulp watch
[20:24:06] Using gulpfile /mnt/f/www/v2/gulpfile.js
[20:24:06] Starting 'watch'...
[20:24:06] 'watch' errored after 27 ms
[20:24:06] Error: watch /mnt/f/www/v2/src/postcss/ EPERM
    at exports._errnoException (util.js:1026:11)
    at FSWatcher.start (fs.js:1429:19)
    at Object.fs.watch (fs.js:1456:11)
    at Gaze._watchDir (/mnt/f/www/v2/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:289:30)
    at /mnt/f/www/v2/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:358:10
    at iterate (/mnt/f/www/v2/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/helper.js:52:5)
    at Object.forEachSeries (/mnt/f/www/v2/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/helper.js:66:3)
    at Gaze._initWatched (/mnt/f/www/v2/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:354:10)
    at Gaze.add (/mnt/f/www/v2/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:177:8)
    at new Gaze (/mnt/f/www/v2/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:74:10)

This error only occurs when running on Windows (Bash). On a Unix system, it works completely fine. Also, I've checked the permissions for every file and folder in the project, which are all rwxrwxrwx.

@ForsakenHarmony

This comment has been minimized.

Show comment
Hide comment
@ForsakenHarmony

ForsakenHarmony Dec 4, 2016

it's a bug with bash for windows fixed in build 14942

it's a bug with bash for windows fixed in build 14942

@phated

This comment has been minimized.

Show comment
Hide comment
@phated

phated Dec 4, 2016

Member

@ForsakenHarmony do you know if that has shipped in the official channel yet?

Member

phated commented Dec 4, 2016

@ForsakenHarmony do you know if that has shipped in the official channel yet?

@ForsakenHarmony

This comment has been minimized.

Show comment
Hide comment
@ForsakenHarmony

ForsakenHarmony Dec 4, 2016

@phated going by my windows build version: No

Settings > System > About

ForsakenHarmony commented Dec 4, 2016

@phated going by my windows build version: No

Settings > System > About

@McQuinTrix

This comment has been minimized.

Show comment
Hide comment
@McQuinTrix

McQuinTrix Jan 31, 2018

This might be related to permissions. I just did my gulp task with sudo and it worked perfectly.

sudo gulp

This might be related to permissions. I just did my gulp task with sudo and it worked perfectly.

sudo gulp

@ebitauld

This comment has been minimized.

Show comment
Hide comment
@ebitauld

ebitauld May 23, 2018

I got the same and resolved by using gulp cache control.

I don't understand why, but it works!

Example:

var cache = require('gulp-cached');

gulp.task('cache:docsource', function(){
    return gulp.src('./app/**/*.*').pipe(cache('cacheDocSource'));
});

gulp.task('sass', function () {
  return gulp.src(''./app/scss/**/*.scss')
    .pipe(cache('cacheDocSource'))
    .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
    .pipe(gulp.dest('./dist/css'));
});

gulp.task('sass:watch', ['cache:docsource'], function () {
  gulp.watch('./app/scss/**/*.scss', ['sass']);
});

ebitauld commented May 23, 2018

I got the same and resolved by using gulp cache control.

I don't understand why, but it works!

Example:

var cache = require('gulp-cached');

gulp.task('cache:docsource', function(){
    return gulp.src('./app/**/*.*').pipe(cache('cacheDocSource'));
});

gulp.task('sass', function () {
  return gulp.src(''./app/scss/**/*.scss')
    .pipe(cache('cacheDocSource'))
    .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
    .pipe(gulp.dest('./dist/css'));
});

gulp.task('sass:watch', ['cache:docsource'], function () {
  gulp.watch('./app/scss/**/*.scss', ['sass']);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment