events.js:160 throw er; // Unhandled 'error

2019-02-01 08:17发布

The project I worked on was built with gulp.

Recently I updated the node version to v6.3.1. Then something came wrong.

A task named 'html' throws an error. Here is the part of error code of it.

bogon:toClient work$ gulp html
(node:2519) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.

[10:26:10] Using gulpfile ~/Project/TIME_Cancer_Treatment_Centers_of_America(CTCA)/toClient/gulpfile.js
[10:26:10] Starting 'html'...
(node:2519) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.

events.js:160
      throw er; // Unhandled 'error' event
      ^
Error: CSS parse error scripts/vendor.js: Unexpected input
    1 |!function(t,e){"object"==typeof module&&"object"==typeof module.exports?module.exports=t.document?e(t,!0):function(t){if(!t.document)throw new Error("jQuery requires a window with a document");return e(t)}:e(t)}("undefined"!=typeof window?window:this,function(t,e){function i(t){var e="length"in t&&t.length,i=J.type(t);return"function"!==i&&!J.isWindow(t)&&(!(1!==t.nodeType||!e)||("array"===i||0===e||

And the code of task 'html':

var $ = require('gulp-load-plugins')();

gulp.task('html', function() {
  var assets = $.useref.assets({searchPath: ['.tmp']});

  return gulp.src('app/*.html')
    .pipe(assets)
    .pipe($.if('*.js', $.uglify()))
    .pipe($.if('*.css', $.csso()))
    .pipe(assets.restore())
    .pipe($.useref())
    .pipe($.if('*.html', $.minifyHtml({conditionals: true, loose: true})))
    .pipe(gulp.dest('dist'));
});

I googled a lot but I haven't found a proper answer suitable for me.

12条回答
beautiful°
2楼-- · 2019-02-01 08:30

In my case the port already in use..

# netstat -nltp

Check is there any thing running with port which are trying to start with..if yes change port and try.

Some cases IP address also may wrong if using static IP

查看更多
成全新的幸福
3楼-- · 2019-02-01 08:32

I had similar problem with events.js.

[19:59:06] Starting 'jekyll-async'...

events.js:72
    throw er; // Unhandled 'error' event
          ^
Error: spawn ENOENT
    at errnoException (child_process.js:1011:11)
    at Process.ChildProcess._handle.onexit (child_process.js:802:34)

In my case problem occurred because I forgot to install gems from my Gemfile (after complete system reinstall).

So, cure for me was:

gem install jekyll
查看更多
贪生不怕死
4楼-- · 2019-02-01 08:32

You can uninstall your node,and install lastest version.

查看更多
SAY GOODBYE
5楼-- · 2019-02-01 08:33

I was facing similar error while running my create-react-app on Ubuntu, while running a command npm start

It gets solved when I run sudo npm start

I think a problem might be with application not having enough permissions.

查看更多
▲ chillily
6楼-- · 2019-02-01 08:37

removing the node_modules folder, clearing npm cached files, and doing a fresh install, resolves this issue.

rm -rf node_modules && npm cache clean --force && npm install

source: https://github.com/ember-cli/ember-cli/issues/3087#issuecomment-71327402

查看更多
Deceive 欺骗
7楼-- · 2019-02-01 08:39

Changing the port number worked for me. As port 5000 was already in use in my system. hope it helps

查看更多
登录 后发表回答