我的gulp代码有问题。 每次我尝试使用gulp制作dist文件时都会出现错误。 使用GulpUglify工具的东西。 (我对使用npm还是比较新的,所以也许我在安装上做错了。如果您认为是这种情况,请解释我必须采取的确切步骤,以便它不会再出错。 我试图找到一个解决方案,但没有一个帮助。 我在我的js代码中使用es6。 以下是我尝试过的一些链接 (如果您需要更多信息请说出来!)
How to minify ES6 functions with gulp-uglify?(这个与我没有相同的错误,但它可能与es6有关)
https://github.com/terinjokes/gulp-uglify/issues/249(我尝试用这个做点什么,但我是新手,我从朋友那里得到了我的文件,所以我可以有一个本地主机)
https://github.com/terinjokes/gulp-uglify/issues/281(等)
以下是控制台中显示的内容。
throw er; // Unhandled 'error' event
^
GulpUglifyError: unable to minify JavaScript
at createError (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/gulp-uglify/lib/create-error.js:6:14)
at wrapper (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/lodash/_createHybrid.js:87:15)
at trycatch (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/gulp-uglify/minifier.js:26:12)
at DestroyableTransform.minify [as _transform] (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/gulp-uglify/minifier.js:79:19)
at DestroyableTransform.Transform._read (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/readable-stream/lib/_stream_transform.js:182:10)
at DestroyableTransform.Transform._write (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/readable-stream/lib/_stream_transform.js:170:83)
at doWrite (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/readable-stream/lib/_stream_writable.js:406:64)
at writeOrBuffer (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/readable-stream/lib/_stream_writable.js:395:5)
at DestroyableTransform.Writable.write (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/readable-stream/lib/_stream_writable.js:322:11)
at Readable.ondata (_stream_readable.js:642:20)
at Readable.emit (events.js:159:13)
at addChunk (_stream_readable.js:265:12)
at readableAddChunk (_stream_readable.js:252:11)
at Readable.push (_stream_readable.js:209:10)
at /Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/fork-stream/index.js:51:13
at classifier (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/ternary-stream/index.js:20:11)