1

ENOSPC

在ubuntu系统

Node.JS Error: ENOSPC

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

示例

var gulp = require('gulp')
var sass = require('gulp-sass')
var uglify = require('gulp-uglify')
var minifyCss = require('gulp-minify-css')
var htmlMin = require('gulp-htmlmin')
var pump = require('pump')
var del = require('del')

// 编译scss为css
gulp.task('sass', function () {
  return gulp.src('./scss/**/*.scss')
    .pipe(sass.sync().on('error', sass.logError))
    .pipe(gulp.des```t('./css'));
})

// 监测并自动编译scss
gulp.task('sass:watch', function () {
  gulp.watch('./scss/**/*.scss', ['sass']);
})

// 打包前删除dist内文件
gulp.task('clean:dist', function () {
  del.sync(['./dist/**/*'])
})

// 打包任务
gulp.task('build', ['clean:dist'], function () {
  gulp.src('./css/**/*.css')
    .pipe(minifyCss())
    .pipe(gulp.dest('./dist/css'))
  gulp.src('./font/**/*')
    .pipe(gulp.dest('./dist/font'))
  gulp.src('./images/**/*')
    .pipe(gulp.dest('./dist/images'))
  gulp.src('./favicon.ico')
    .pipe(gulp.dest('./dist/'))
  pump([
    gulp.src('./js/**/*.js'),
    uglify(),
    gulp.dest('./dist/js')
  ])
  gulp.src('./*.html')
    .pipe(htmlMin({
      removeComments: true,
      collapseWhitespace: true,
      minifyJS: true,
      minifyCSS: true
    }))
    .pipe(gulp.dest('./dist'))
})

image.png


白鲸鱼
1k 声望110 粉丝

方寸湛蓝