Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using gulp with a team on a Local Server. Error: EPERM: operation not permitted, chmod

I am working with a web team and we keep all our files on a local shared server in the office. ( we are slowly moving everything over to git so please no comments about how dumb we are for not using git. Thanks! )

We are using gulp to compile our sass to css and when one of us compiles we are fine but once someone else tries to run a node process and compile with gulp we get the following error....

[10:12:53] Starting 'sass'...
   [10:12:53] Starting 'watch'...
   [10:12:54] Finished 'watch' after 173 ms
   [10:12:54] 'sass' errored after 442 ms
    EPERM: operation not permitted, chmod '/the file path/'

I have tried using chmod to change the file permissions but I don't think that is the issue. I use atom as my editor and some of the other developers on the team use sublime.

I have read that some editors can lock files. Not sure if this is the cause but if it is I don't know how to fix this. Is the only solution to this problem to use git and have local copies on our own personal computers?

Thanks in advance!

gulpfile.js

// Include gulp
var gulp = require('gulp');

// Include Our Plugins
var sass = require('gulp-sass');
var plumber = require('gulp-plumber');
var cleanCSS = require('gulp-clean-css');
var sourcemaps = require('gulp-sourcemaps');


var sassOptions = {
    errLogToConsole: true,
    outputStyle: 'nested' // Styles: nested, compact, expanded, compressed
};

// Compile Sass file to CSS, and reload browser(s).
gulp.task('sass', function() {
    return gulp.src('includes/scss/*.scss')
        .pipe(plumber())
        .pipe(sourcemaps.init())
        .pipe(sass.sync(sassOptions))
        .pipe(sass.sync().on('error', sass.logError))
        .pipe(sourcemaps.write())
        .pipe(gulp.dest('includes/css'));
});

gulp.task('minify-css', function() {
  return gulp.src('includes/css/*.css')
    .pipe(sourcemaps.init({loadMaps: true}))
    .pipe(cleanCSS({compatibility: 'ie8'}))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest('includes/css'));
});

// Watch Files For Changes
gulp.task('watch', function() {
  gulp.watch('includes/scss/**/*.scss', ['sass']);
});

// Default Task
//gulp.task('serve', ['sass', 'minify-css', 'watch']);
gulp.task('serve', ['sass', 'watch']);
like image 932
Garrett Sanderson Avatar asked Oct 19 '25 12:10

Garrett Sanderson


1 Answers

This happens because you need to run your gulpfile as admin. So run sudo -i, insert your admin password, and then just run again. I was on the same problem, it worked for me.

like image 96
Julio Graffin Avatar answered Oct 22 '25 05:10

Julio Graffin