events.js:160 throw er; //未处理的'错误'事件

时间:2021-02-28 00:09:36

The project I worked on was built with gulp.

我工作的项目是用gulp构建的。

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

最近我将节点版本更新到v6.3.1。然后出了点问题。

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

名为“html”的任务会引发错误。这是它的错误代码的一部分。

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':

和任务'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.

我google了很多,但我没有找到适合我的正确答案。

11 个解决方案

#1


31  

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

删除node_modules文件夹,清除npm缓存文件和执行全新安装,可以解决此问题。

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

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

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

#2


9  

Regarding the error at the following line:

关于以下行的错误:

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

The issue for me was that I already had the port open on another local node app.

对我来说问题是我已经在另一个本地节点应用程序上打开了端口。

Stopping the other app resolved the issue.

停止其他应用已解决此问题。

#3


2  

Lately, I changed the node version to v5.10.0 and everything just acted well.

最近,我将节点版本更改为v5.10.0,一切都很好。

#4


1  

I had similar problem with events.js.

我和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).

在我的情况下出现问题,因为我忘了从我的Gemfile安装gems(完成系统重新安装后)。

So, cure for me was:

所以,治愈我是:

gem install jekyll

#5


1  

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

如果使用静态IP,某些情况下IP地址也可能出错

#6


1  

Try to kill other gulp processes.

尝试杀死其他gulp进程。

ps -ax | grep gulp
kill -9 <number>

#7


0  

events.js:160

events.js:160

This is because

这是因为

  1. The port using another node so you change the port of node from server.js

    端口使用另一个节点,因此您可以从server.js更改节点的端口

    2.or stop the other app use the same port .

    2.或者停止其他应用程序使用相同的端口。

#8


0  

I was getting the same error while starting laravel-echo-server npm package. PFA image for reference. I think if you are getting error beacuse of any npm package this answer will be helpful to you.

我在启动laravel-echo-server npm包时遇到了同样的错误。 PFA图片供参考。我想如果你因为任何npm包而得到错误,这个答案将对你有所帮助。

events.js:160 throw er; //未处理的'错误'事件

How I found solution :

我如何找到解决方案:

  • My domain was not properly configured. Check in the image, I'm trying to hit pid.contentcentral.co domain, which was disabled or not properly configured. Hence throws the error. Correction in the configuration and issue resolved.
  • 我的域名配置不正确。检查图像,我正在尝试访问pid.contentcentral.co域,该域已被禁用或未正确配置。因此抛出错误。已解决配置和问题的更正。

Other Important points :

其他要点:

  • Error: listen EADDRNOTAVAIL error in Node.js

    错误:在Node.js中侦听EADDRNOTAVAIL错误

    When you see this line in error not the port but definitely your IP Address / Domain has got some trouble.

    当你看到这行错误而不是端口,但你的IP地址/域肯定有问题。

  • Error: listen EADDRINUSE

    错误:听EADDRINUSE

    When you see this line in error not your IP Address / Domain but definitely port has got some trouble may be already in use.

    当您看到此行错误而不是您的IP地址/域但是肯定端口有一些麻烦可能已经在使用中。

#9


0  

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

我在Ubuntu上运行我的create-react-app时遇到了类似的错误,同时运行命令npm start

It gets solved when I run sudo npm start

当我运行sudo npm start时它会得到解决

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

我认为问题可能是应用程序没有足够的权限。

#10


0  

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

更改端口号对我有用。由于端口5000已经在我的系统中使用。希望能帮助到你

#11


-1  

You can uninstall your node,and install lastest version.

您可以卸载节点,并安装最新版本。

#1


31  

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

删除node_modules文件夹,清除npm缓存文件和执行全新安装,可以解决此问题。

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

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

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

#2


9  

Regarding the error at the following line:

关于以下行的错误:

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

The issue for me was that I already had the port open on another local node app.

对我来说问题是我已经在另一个本地节点应用程序上打开了端口。

Stopping the other app resolved the issue.

停止其他应用已解决此问题。

#3


2  

Lately, I changed the node version to v5.10.0 and everything just acted well.

最近,我将节点版本更改为v5.10.0,一切都很好。

#4


1  

I had similar problem with events.js.

我和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).

在我的情况下出现问题,因为我忘了从我的Gemfile安装gems(完成系统重新安装后)。

So, cure for me was:

所以,治愈我是:

gem install jekyll

#5


1  

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

如果使用静态IP,某些情况下IP地址也可能出错

#6


1  

Try to kill other gulp processes.

尝试杀死其他gulp进程。

ps -ax | grep gulp
kill -9 <number>

#7


0  

events.js:160

events.js:160

This is because

这是因为

  1. The port using another node so you change the port of node from server.js

    端口使用另一个节点,因此您可以从server.js更改节点的端口

    2.or stop the other app use the same port .

    2.或者停止其他应用程序使用相同的端口。

#8


0  

I was getting the same error while starting laravel-echo-server npm package. PFA image for reference. I think if you are getting error beacuse of any npm package this answer will be helpful to you.

我在启动laravel-echo-server npm包时遇到了同样的错误。 PFA图片供参考。我想如果你因为任何npm包而得到错误,这个答案将对你有所帮助。

events.js:160 throw er; //未处理的'错误'事件

How I found solution :

我如何找到解决方案:

  • My domain was not properly configured. Check in the image, I'm trying to hit pid.contentcentral.co domain, which was disabled or not properly configured. Hence throws the error. Correction in the configuration and issue resolved.
  • 我的域名配置不正确。检查图像,我正在尝试访问pid.contentcentral.co域,该域已被禁用或未正确配置。因此抛出错误。已解决配置和问题的更正。

Other Important points :

其他要点:

  • Error: listen EADDRNOTAVAIL error in Node.js

    错误:在Node.js中侦听EADDRNOTAVAIL错误

    When you see this line in error not the port but definitely your IP Address / Domain has got some trouble.

    当你看到这行错误而不是端口,但你的IP地址/域肯定有问题。

  • Error: listen EADDRINUSE

    错误:听EADDRINUSE

    When you see this line in error not your IP Address / Domain but definitely port has got some trouble may be already in use.

    当您看到此行错误而不是您的IP地址/域但是肯定端口有一些麻烦可能已经在使用中。

#9


0  

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

我在Ubuntu上运行我的create-react-app时遇到了类似的错误,同时运行命令npm start

It gets solved when I run sudo npm start

当我运行sudo npm start时它会得到解决

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

我认为问题可能是应用程序没有足够的权限。

#10


0  

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

更改端口号对我有用。由于端口5000已经在我的系统中使用。希望能帮助到你

#11


-1  

You can uninstall your node,and install lastest version.

您可以卸载节点,并安装最新版本。