gulp构建前端文件发生的错误:node:17232

今天想帮着同事把AngularJS的前端项目进行优化一下,增加index注入部分,结果node直接报错node:17232.具体错误如下:

(node:17232) UnhandledPromiseRejectionWarning
(node:17232) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:17232) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.


采用的是webstorm开发环境,采用的是node8.15.0,gulp-inject为4.1.0.

开始查找原因

1、因为是使用了gulp-inject,先运行一个没有注入的指令试试。

运行clean

gulp.task('clean', function () {
    del(['build/*.*']);
});

运行css

gulp.task('css', function () {
    return gulp.src('./src/**/*.less')
        .pipe(less())
        //.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
        //.pipe(gulp.dest('./styles'))
        .pipe(rename({suffix: '.min'}))
        .pipe(minifycss())
        .pipe(gulp.dest('dist/css'))
        .pipe(livereload())
        .pipe(notify({message: 'css task complete'}));
});

也没有问题,看来就是gulp-inject引起的node报错了。

搜索度娘,没找到。

先屏蔽inject中的内容,没有问题。挨个看src,发现是由于某些js文件没有按照AngularJS的语法编写造成的,排除这些js文件,改为手工写死到index.html中,只注入符合语法的文件。注入通过。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值