Running gulp-livereload + tiny-lr, in two projects, i have an error only at last project, when i use the same gulpfile.js, tried run only one per once, but not work, only my last project got the error:
... Uhoh. Got error listen EADDRINUSE ...
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 Server.listen (/var/www/havikhunting/node_modules/gulp-livereload/node_modules/tiny-lr/lib/server.js:138:15)
at Function.exports.listen (/var/www/havikhunting/node_modules/gulp-livereload/gulp-livereload.js:68:12)
at Function.exports.changed (/var/www/havikhunting/node_modules/gulp-livereload/gulp-livereload.js:88:20)
at Transform.reload._transform (/var/www/havikhunting/node_modules/gulp-livereload/gulp-livereload.js:24:13)
at Transform._read (_stream_transform.js:179:10)
at Transform._write (_stream_transform.js:167:12)
[gulp] Starting 'compileStyles'...
[gulp] Finished 'compileStyles' after 52 ms
[15:06:10] gulp-ruby-sass: directory
[15:06:11] gulp-ruby-sass: error ./style.scss (Line 1: File to import not found or unreadable: ../partials/base.
Load path: /tmp/gulp-ruby-sass)
my gulpfile:
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
minifycss = require('gulp-minify-css'),
refresh = require('gulp-livereload'),
server = require('tiny-lr')();
gulp.task('default', function() {
// Tarefas
});
gulp.task('compileStyles', function() {
gulp.src('public/assets/css/style.scss')
.pipe(sass({
noCache : true,
precision : 4,
unixNewlines : true
}))
.pipe(minifycss())
.pipe(gulp.dest('public/assets/css'))
.pipe(refresh(server));
});
gulp.task('watch', function() {
server.listen(35729, function( err ) {
if ( err ) { return console.log( err ); }
gulp.watch('public/assets/css/**/*.{sass,scss}', [
'compileStyles'
]);
});
});
The error message says the livereload server is failing to load because the address is already in use.
Are you running the projects at the same time? To do that, you need the two livereload servers to be on different ports. You can configure that by changing 35729
to 35728
in one of your gulp files.
Depending on how your browser is setup, you may need to adjust its settings. Give it a try though, it might be fine.