Code Monkey home page Code Monkey logo

Comments (18)

reintroducing avatar reintroducing commented on August 16, 2024

Same thing here, when I run my default gulp task (which includes the 'webserver' task) I see this error pop up a bunch of times initially. Once my default task finishes running and I'm editing files everything is working fine and livereload works as expected so it doesn't seem like the error is breaking anything but it is odd to see it in terminal that many times.

from gulp-webserver.

davejlong avatar davejlong commented on August 16, 2024

I'm getting an error when I turn on livereload:

fs.js:1056
    throw errnoException(process._errno, 'watch');
          ^
Error: watch EMFILE
    at errnoException (fs.js:1024:11)
    at FSWatcher.start (fs.js:1056:11)
    at Object.fs.watch (fs.js:1081:11)
    at watch (/Users/davejlong/Projects/recruitics/insights_design/node_modules/gulp-webserver/node_modules/node-watch/lib/watch.js:221:8)
    at /Users/davejlong/Projects/recruitics/insights_design/node_modules/gulp-webserver/node_modules/node-watch/lib/watch.js:230:9
    at /Users/davejlong/Projects/recruitics/insights_design/node_modules/gulp-webserver/node_modules/node-watch/lib/watch.js:41:14
    at Array.forEach (native)
    at /Users/davejlong/Projects/recruitics/insights_design/node_modules/gulp-webserver/node_modules/node-watch/lib/watch.js:38:18
    at Object.oncomplete (fs.js:107:15)

from gulp-webserver.

reintroducing avatar reintroducing commented on August 16, 2024

@davejlong Try setting your ulimit to be higher:

ulimit -n 4000

I put this in my .zshrc so it runs on startup whenever I open terminal.

from gulp-webserver.

davejlong avatar davejlong commented on August 16, 2024

@reintroducing That's scary. My project consists of far less than 256 files (my current ulimit for file descriptors), so what is the webserver doing with livereload that needs so many file descriptors open?

from gulp-webserver.

reintroducing avatar reintroducing commented on August 16, 2024

No idea and a valid concern but it works for me :)

from gulp-webserver.

davejlong avatar davejlong commented on August 16, 2024

So I did some testing and this is what I found. With this gulp script:

var gulp = require('gulp'),
    sass = require('gulp-sass'),
    webserver = require('gulp-webserver'),
    concat = require('gulp-concat'),
    jshint = require('gulp-jshint'),
    stylish = require('jshint-stylish');

gulp.task('serve', ['scripts', 'styles'], function () {
  return gulp.src(['.', '!node_modules'])
    .pipe(webserver({
      livereload: true,
      fallback: 'index.html',
      directoryListing: true,
      open: true
    }));
});

gulp.task('styles', function () {
  return gulp.src('scss/app.scss')
    .pipe(sass({
      includePaths: ['bower_components/foundation/scss']
    }))
    .on('error', function (err) { console.log(err.message); })
    .pipe(gulp.dest('css'));
});

gulp.task('scripts', function () {
  return gulp.src(['!js/all.js', 'js/app.js', 'js/**/*.js'])
    .pipe(jshint())
    .pipe(jshint.reporter(stylish))
    .pipe(concat('all.js'))
    .pipe(gulp.dest('js'));
});

gulp.task('develop', ['serve'], function () {
  var cb = function () {};
  gulp.watch('scss/**/*.scss', ['styles'], cb);
  gulp.watch('**/*.html', cb);
  gulp.watch('js/**/*.js', ['scripts'], cb);
});


gulp.task('default', ['styles', 'scripts']);

I found some metrics:

  • Descriptors (lsof -p <pid> | wc -l): 1141
  • Files in directory (find . -type f | wc -l): 4160
  • Descriptors for files in node_modules (lsof -p <pid> | grep node_modules | wc -l): 1030

Finally I looked up descriptors for each Node Module I have running:

for dir in $(ls node_modules)
  print $dir && \
  lsof -p 44445 | grep "$dir/" | wc -l
gulp
     296
gulp-concat
      93
gulp-jshint
     180
gulp-sass
     226
gulp-webserver
     210
jshint-stylish
      17

from gulp-webserver.

fengshuo avatar fengshuo commented on August 16, 2024

I got this error(which is mentioned in issue 11):

throw errnoException(process._errno, 'watch');

Anyone still following this issue?

from gulp-webserver.

davejlong avatar davejlong commented on August 16, 2024

@fengshuo yes I believe that's related to the file descriptors, which this issue really isn't about. Your issue looks to be (from reading the comments on #11) an issue with Gulp (and further the node-watch) library itself, in that you can't set filters to ignore things like files in the node_modules or bower_components directories.

from gulp-webserver.

fengshuo avatar fengshuo commented on August 16, 2024

@davejlong Good to know, I'll check on this, thx

from gulp-webserver.

davejlong avatar davejlong commented on August 16, 2024

I'm interested in if @schickling is actually still developing this library or not. All I see in commits is that he's merging PRs and bumping versions.

from gulp-webserver.

schickling avatar schickling commented on August 16, 2024

Hey @davejlong. Sorry, I'm currently pretty busy and unfortunately don't have the time right now to actively develop on this plugin.

If any of you guys are interested in maintaining this package, please let me know!

from gulp-webserver.

davejlong avatar davejlong commented on August 16, 2024

I’m about to start a new gig that may give me some extra time. I’ll try to get some PRs towards the bugs that are open. In the end I just really want a solid Gulp plugin for running a server in development.

Dave Long

Sent from Mailbox

On Wed, Sep 3, 2014 at 7:20 PM, Johannes Schickling
[email protected] wrote:

Hey @davejlong. Sorry, I'm currently pretty busy and unfortunately don't have the time right now to actively develop on this plugin.

If any of you guys are interested in maintaining this package, please let me know!

Reply to this email directly or view it on GitHub:
#29 (comment)

from gulp-webserver.

schickling avatar schickling commented on August 16, 2024

Thanks @davejlong. That sounds awesome! I have the same goal. 👍

from gulp-webserver.

reintroducing avatar reintroducing commented on August 16, 2024

@davejlong awesome, thank you for fixing this, much appreciated.

from gulp-webserver.

reintroducing avatar reintroducing commented on August 16, 2024

hmm, i spoke too soon. After updating to this version my livereload is no longer working. I changed nothing in my config from the previous working version. LR is just dead no :\

from gulp-webserver.

reintroducing avatar reintroducing commented on August 16, 2024

Ah, ok, I know why. You're ignoring node_modules from the livereload. This poses a bit of a problem because the proper usage of browserify in the documentation suggests that you should put your JS code in the node_modules folder (something like /app, lets say) so that you can then easily include your modules (see https://github.com/substack/browserify-handbook#avoiding-). I think this needs an option to pass directories to include in the watch, so ideally by default it would ignore everything in node_modules unless it was passed an option of folders to NOT ignore. Thoughts?

from gulp-webserver.

davejlong avatar davejlong commented on August 16, 2024

You can pass a custom filter to livereload for which files to ignore:

webserver({
    livereload: {
        enable: true,
        filter: function (file) {
            // Return true to include file in watch, false to exclude
        }
    }
});

So if you just want to watch html files, do something like:

...
filter: function (file) {
    if (filename.match(/node_modules/)) {
        if (filename.match(/\.html/)) { return true; }
        else { return false; }
    } else { return true; }
}
...

from gulp-webserver.

reintroducing avatar reintroducing commented on August 16, 2024

Thanks for the update. I chose to move my JS out of the node_modules folder after all as it was causing some other issues :)

from gulp-webserver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.