P
P
pasha bpv2014-10-22 22:20:18
gulp.js
pasha bpv, 2014-10-22 22:20:18

Why is gulp-connect throwing an error?

Hello! Can you tell me why I get an error when I run gulp? Something with gulp-connect.
here is my config file:

var gulp = require('gulp'),
    concatCSS = require('gulp-concat-css'),
    rename = require('gulp-rename'),
    notify = require('gulp-notify'),
    minifyCSS = require('gulp-minify-css'),
    autoprefixer = require('gulp-autoprefixer'),
    livereload = require('gulp-livereload'),
    connect = require('gulp-connect');

// server connect
gulp.task('connect', function() {
  connect.server({
    root: './',
    livereload: true
  });
});

// css
gulp.task('css', function () {
  gulp.src('style/css/*.css')
    .pipe(concatCSS("style.css"))
    .pipe(autoprefixer({
            browsers: ['last 15 versions']
        }))
    .pipe(minifyCSS())
    .pipe(rename('style.min.css'))
    .pipe(gulp.dest('style/css'))
    .pipe(connect.reload());
});

// html
gulp.task('html', function(){
  gulp.src('./')
  .pipe(connect.reload());
});


// watch
gulp.task('watch', function(){
  gulp.watch('style/css/*.css', ['default'])
  gulp.watch('./*.html', ['html'])
});

// default
gulp.task('default', ['connect', 'html', 'css', 'watch']);

Here's what's in the terminal:
events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: listen EADDRINUSE
    at errnoException (net.js:904:11)
    at Server._listen2 (net.js:1042:14)
    at listen (net.js:1064:10)
    at Server.listen (net.js:1138:5)
    at ConnectApp.server (C:\Users\pasha\Copy\web-development\PROJECTS\LP_worldofpc\node_modules\gulp-connect\index.js:57:12)
    at new ConnectApp (C:\Users\pasha\Copy\web-development\PROJECTS\LP_worldofpc\node_modules\gulp-connect\index.js:37:10)
    at Object.module.exports.server (C:\Users\pasha\Copy\web-development\PROJECTS\LP_worldofpc\node_modules\gulp-connect\index.js:135:12)
    at Gulp.gulp.task.gulp.src.pipe.pipe.autoprefixer.browsers (C:\Users\pasha\Copy\web-development\PROJECTS\LP_worldofpc\gulpfile.js:12:11)
    at module.exports (C:\Users\pasha\Copy\web-development\PROJECTS\LP_worldofpc\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:34:7)
    at Gulp.Orchestrator._runTask (C:\Users\pasha\Copy\web-development\PROJECTS\LP_worldofpc\node_modules\gulp\node_modules\orchestrator\index.js:273:3)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pasha bpv, 2014-10-24
@pahann

Found the error myself.
The reason was in this line - gulp.watch('style/css/*.css', ['default'])
but it was necessary -
gulp.watch('style/css/*.css', ['css'])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question