gulp.dest uses chmod on files
See original GitHub issueWhen I pipe my compiled css into gulp.dest(folder) it will fail with an error:
events.js:72
throw er; // Unhandled 'error' event
^
Error: EPERM, chmod 'css/screen.css'
This is because screen.css
already exits and only gets overriden - however the user running gulp isn’t the owner of the file.
This is a bug since according to the documentation chmod gets applied to new folders only:
options.mode - Octal permission string specifying mode for any folders that need to be created for output folder.
Code:
var gulp = require('gulp');
var sass = require('gulp-sass');
gulp.task('default', function() {
gulp.src(sassUri + '**/*.{scss,sass}')
.pipe(sass())
.pipe(gulp.dest('css'));
});
PS: If this isn’t a bug but a feature, how can I turn this off (or handle it properly)?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:4
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Gulp - Handle read-only permissions for dest files?
You can use gulp-chmod to handle permissions on your files. So if you want to set your images readable and writable for everybody,...
Read more >gulp-chmod - npm
Change permissions of Vinyl files. ... Start using gulp-chmod in your project by running `npm i gulp-chmod`. ... gulp.src('src/app.js').
Read more >dest() - gulp.js
Creates a stream for writing Vinyl objects to the file system. ... If a function is used, the function will be called with...
Read more >Gulp-chmod NPM - npm.io
Specify true to use the same value as fileMode . Tip. Combine it with gulp-filter to only change permissions on a subset of...
Read more >JavaScript gulp-chmod Examples - HotExamples
gulp.task('copy-styles', function() { return merge( gulp.src(config.files.vendor.css) .pipe(chmod(644)) .pipe(gulp.dest(dist_dir + '/assets/css')), ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, I understand how chmod works on GNU/Linux. But on my systems gulp can and will by run by many different users (which are in the same group, though). IMO gulp has absolutely no need to run chmod on this file, since he only needs to write to it.
If I’m unable to turn of this feature I’m absolute ok with catching and ignoring it - my only intention is that the watcher doesn’t fail because of this. Could you show me an example how to catch this error?
@hashworks There was a bug with the chmod stuff in 3.x - feel free to use the 4.0 stuff it’s stable, just waiting on a few more issues to land before we publish