events.js:160 扔呃; // 未处理的 'error' 事件

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

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

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

名为 '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||

任务代码'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'));
});

我用谷歌搜索了很多,但没有找到适合我的正确答案。

最近,我将节点版本更改为 v5.10.0,一切正常。

删除 node_modules 文件夹,清除 npm 缓存文件,然后进行全新安装,解决了这个问题。

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

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

我遇到了与 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)

在我的案例中,问题发生是因为我忘记从我的 Gemfile 安装 gems(在完全重新安装系统后)。

所以,我的治疗方法是:

gem install jekyll

在我的例子中,端口已经在使用中..

# netstat -nltp

检查是否有任何 运行 端口正试图从...开始。如果是,请更改端口并尝试。

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

关于以下行的错误:

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

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

停止其他应用程序解决了问题。

尝试终止其他 gulp 个进程。

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

events.js:160

这是因为

  1. 使用其他节点的端口所以你把节点的端口改成server.js

    2.or 停止使用同一端口的其他应用程序。

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

我是如何找到解决方案的:

  • 我的域配置不正确。检查图像,我正在尝试访问 pid.contentcentral.co 域,该域已被禁用或配置不正确。因此抛出错误。更正配置并解决问题。

其他要点:

  • 错误:在 Node.js

    中侦听 EADDRNOTAVAIL 错误

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

  • 错误:听 EADDRINUSE

    当您看到此行错误时,不是您的 IP 地址/域,而是端口肯定有问题,可能已经在使用中。

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

当我 运行 sudo npm start

就解决了

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

我在 Ubuntu 上遇到了类似的错误,而 运行 命令 npm start

运行 sudo npm start 解决了我的问题

我认为这是因为文件夹没有Morgan logger 的写入权限。

解决方法: $event => 只能用于 .ts 文件。

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

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

如果您使用的是 .js 文件,请像这样使用它

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

尝试运行以下命令,然后执行您想要执行的操作

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

希望有用。

设置环境变量windows/system32
它适用于 windows