Unable to minify JavaScript

PS C:\Users\alex\apflora> gulp prod_build_src
(node:1144) 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.
[15:28:13] Using gulpfile ~\apflora\gulpfile.js
[15:28:13] Starting ‘prod_build_src’…

events.js:160

1
2
throw er; // Unhandled 'error' event
^

GulpUglifyError: unable to minify JavaScript

1
2
3
4
5
6
7
8
9
10
at createError (C:\Users\alex\apflora\node_modules\gulp-uglify\lib\create-error.js:6:14)
at wrapper (C:\Users\alex\apflora\node_modules\gulp-uglify\node_modules\lodash\_createHybrid.js:87:15)
at trycatch (C:\Users\alex\apflora\node_modules\gulp-uglify\minifier.js:26:12)
at DestroyableTransform.minify [as _transform] (C:\Users\alex\apflora\node_modules\gulp-uglify\minifier.js:76:19)
at DestroyableTransform.Transform._read (C:\Users\alex\apflora\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:172:10)
at DestroyableTransform.Transform._write (C:\Users\alex\apflora\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:160:12)
at doWrite (C:\Users\alex\apflora\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:335:12)
at writeOrBuffer (C:\Users\alex\apflora\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:321:5)
at DestroyableTransform.Writable.write (C:\Users\alex\apflora\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:248:11)
at write (C:\Users\alex\apflora\node_modules\gulp-concat\node_modules\readable-stream\lib\_stream_readable.js:623:24)

PS C:\Users\alex\apflora>

解决方法

如遇到这个问题,可以检查gulpfile.js中调用的插件是否都成功安装,是否需要升级。特别留意安装后提示的警告(WARNING)