-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
gulp.dest error: eperm, open #1057
Comments
This may be a vinyl-fs issue with windows (or deeper). Thoughts? |
This is not a problem with gulp, so I apologize for posting it here but I will present a solution to those that found themselves here. Its because the source file has the read-only attribute on it (could be TFS or some other source control or other software putting that on the file). So when fs streams it the source to the destination it contains the same attributes. Simple solution is to stream the source files into gulp-foreach and modify the file.stat.mode. I found I could do this by using bit flag math. I found that when the read-only attribute is applied the mode was missing 128,16, and 2 bits (146). If you turn those bits on the read-only is removed (seems backwards but it works). var gulp = require('gulp'),
foreach = require('gulp-foreach');
var buildDir = 'C:/website/build';
gulp.task('copy-templates', function() {
return gulp.src('./client/templates/**/*.html')
.pipe(foreach(function(stream, file){
if((file.stat.mode & 146) == 0){
file.stat.mode = file.stat.mode | 146;
}
return stream;
}))
.pipe(gulp.dest(buildDir + '/templates'));
}); It might also be cheaper to skip the check and just or the bits :) |
I am just using gulp src and dest to copy files to a location where it will be hosted. Currently nothing has a handle on this dest directory. First time I run the task it completes successfully (folder didn't exist before gulp.dest was called). I run it again and now I see:
This is running on a windows 7 64bit os, here is the gulp code I am running:
If I remove the read-only attribute that is applied to the C:\website\build directory I can successfully run the task over top the existing files.
The text was updated successfully, but these errors were encountered: