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

时间:2023-03-20
本文介绍了events.js:160 抛出 er;//未处理的“错误"事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我从事的项目是用 gulp 构建的.

The project I worked on was built with gulp.

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

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

名为html"的任务引发错误.这是它的错误代码部分.

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

以及任务'html'的代码:

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.

推荐答案

删除 node_modules 文件夹,清除 npm 缓存文件并进行全新安装,即可解决此问题.

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

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

这篇关于events.js:160 抛出 er;//未处理的“错误"事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:如何使用 gulp-uglify 缩小 ES6 函数? 下一篇:events.js: 141 投掷者;//未处理的“错误"事件

相关文章