简体   繁体   English

events.js:160 抛出 er; // 未处理的“错误”事件

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

The project I worked on was built with gulp.我参与的项目是用 gulp 构建的。

Recently I updated the node version to v6.3.1.最近我将节点版本更新到了 v6.3.1。 Then something came wrong.然后出了点问题。

A task named 'html' throws an error.名为“html”的任务会引发错误。 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':和任务'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.我用谷歌搜索了很多,但没有找到适合我的正确答案。

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

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.停止其他应用程序解决了该问题。

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.我认为问题可能在于应用程序没有足够的权限。

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

Try to kill other gulp processes.尝试杀死其他 gulp 进程。

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

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

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 地址也可能错误

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.或停止其他应用程序使用相同的端口。

I was getting the same error while starting laravel-echo-server npm package.我在启动 laravel-echo-server npm 包时遇到了同样的错误。 PFA image for reference. PFA 图像供参考。 I think if you are getting error beacuse of any npm package this answer will be helpful to you.我想如果你因为任何 npm 包而出错,这个答案会对你有所帮助。

在此处输入图片说明

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.检查图像,我正在尝试访问 pid.contentcentral.co 域,该域已被禁用或未正确配置。 Hence throws the error.因此抛出错误。 Correction in the configuration and issue resolved.更正配置并解决问题。

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 地址/域,但肯定端口有一些问题可能已经在使用中。

Changing the port number worked for me. 更改端口号对我有用。 As port 5000 was already in use in my system. 由于端口5000已经在我的系统中使用。 hope it helps 希望能帮助到你

I was facing similar error on Ubuntu, while running a command npm start在运行命令 npm start 时,我在 Ubuntu 上遇到了类似的错误

Running sudo npm start solved my problem运行 sudo npm start 解决了我的问题

I think this is because folder doesn't have write permission for Morgan logger.我认为这是因为文件夹没有摩根记录器的写权限。

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

Solution: $event => can be used only .ts files.解决方案: $event => 只能用于 .ts 文件。

 $scope.openFromCalendar = ($event) => {
        $event.preventDefault();
        $event.stopPropagation();

        $scope.fromCalendarOpened = true;
        $scope.ToCalendarOpened = false;
    };

If you are using .js files use it like如果您使用 .js 文件,请使用它

$scope.openFromCalendar = function ($event) {
                $event.preventDefault();
                $event.stopPropagation();
                $scope.fromCalendarOpened = true;
                $scope.ToCalendarOpened = false;
            };

Try running following command and after that perform your action, you want to perform尝试运行以下命令,然后执行您想要执行的操作

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

I hope it will work.我希望它会起作用。

set env var windows/system32设置环境变量 windows/system32
it will work for windows它适用于 Windows

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM