我帮助开发了一个 Foss 工具,但我在 Fedora29 上的 gulp 中有错误。其他开发人员使用基于 debian 的系统,似乎没问题。Fedora的previopus版本没问题
gulp 文件位于 github,似乎 gulp-babel 在评论中抛出 SyntaxError :
[15:02:50] SyntaxError in plugin "run-sequence(babelify)"
Message:
/var/www/master/assets/packages/adminbasics/build/adminbasics.js: Unexpected token (26258:37)
Details:
pos: 811003
loc: [object Object]
_babel: true
codeFrame: 26256 |
26257 | if (context.method === "throw") {
> 26258 | // If maybeInvokeDelegate
| ^
fileName: /var/www/master/assets/packages/adminbasics/build/adminbasics.js
这里是 gulp 默认的完整结果
[adminbasics]$ gulp --no-color default
[15:02:42] Using gulpfile /var/www/master/assets/packages/adminbasics/gulpfile.js
[15:02:42] Starting 'default'...
[15:02:42] Starting 'compile:production'...
[15:02:42] Starting 'sass:production'...
[15:02:42] Starting 'webpack:production'...
[15:02:42] Finished 'sass:production' after 154 ms
[15:02:42] Version: webpack 3.12.0
Asset Size Chunks Chunk Names
adminbasics.js 871 kB 0 [emitted] [big] main
adminbasics.js.map 1.12 MB 0 [emitted] main
[15:02:42] Finished 'webpack:production' after 894 ms
[15:02:42] Starting 'compress'...
[BABEL] Note: The code generator has deoptimised the styling of "/var/www/master/assets/packages/adminbasics/build/adminbasics.js" as it exceeds the max of "500KB".
[15:02:49] Finished 'compress' after 6.85 s
[15:02:49] Starting 'compresslibs'...
[15:02:49] Finished 'compresslibs' after 4.19 ms
[15:02:49] Finished 'compile:production' after 7.75 s
[15:02:49] Starting 'sass'...
[15:02:49] Starting 'webpack'...
[15:02:49] Starting 'babelify'...
[15:02:49] Finished 'sass' after 59 ms
[15:02:50] Version: webpack 3.12.0
Asset Size Chunks Chunk Names
adminbasics.js 871 kB 0 [emitted] [big] main
adminbasics.js.map 1.12 MB 0 [emitted] main
[15:02:50] 'babelify' errored after 889 ms
[15:02:50] SyntaxError in plugin "gulp-babel"
Message:
/var/www/master/assets/packages/adminbasics/build/adminbasics.js: Unexpected token (26258:37)
[15:02:50] 'default' errored after 8.65 s
[15:02:50] SyntaxError in plugin "run-sequence(babelify)"
Message:
/var/www/master/assets/packages/adminbasics/build/adminbasics.js: Unexpected token (26258:37)
Details:
pos: 811003
loc: [object Object]
_babel: true
codeFrame: 26256 |
26257 | if (context.method === "throw") {
> 26258 | // If maybeInvokeDelegate
| ^
fileName: /var/www/master/assets/packages/adminbasics/build/adminbasics.js
Stack:
SyntaxError: /var/www/master/assets/packages/adminbasics/build/adminbasics.js: Unexpected token (26258:37)
26256 |
26257 | if (context.method === "throw") {
> 26258 | // If maybeInvokeDelegate
| ^
at Parser.pp$5.raise (/var/www/master/assets/packages/adminbasics/node_modules/babylon/lib/index.js:4454:13)
at Parser.pp.unexpected (/var/www/master/assets/packages/adminbasics/node_modules/babylon/lib/index.js:1761:8)
at Parser.pp$3.parseExprAtom (/var/www/master/assets/packages/adminbasics/node_modules/babylon/lib/index.js:3750:12)
at Parser.pp$3.parseExprSubscripts (/var/www/master/assets/packages/adminbasics/node_modules/babylon/lib/index.js:3494:19)
at Parser.pp$3.parseMaybeUnary (/var/www/master/assets/packages/adminbasics/node_modules/babylon/lib/index.js:3474:19)
at Parser.pp$3.parseExprOps (/var/www/master/assets/packages/adminbasics/node_modules/babylon/lib/index.js:3404:19)
at Parser.pp$3.parseMaybeConditional (/var/www/master/assets/packages/adminbasics/node_modules/babylon/lib/index.js:3381:19)
at Parser.pp$3.parseMaybeAssign (/var/www/master/assets/packages/adminbasics/node_modules/babylon/lib/index.js:3344:19)
at Parser.pp$3.parseExpression (/var/www/master/assets/packages/adminbasics/node_modules/babylon/lib/index.js:3306:19)
at Parser.pp$1.parseStatement (/var/www/master/assets/packages/adminbasics/node_modules/babylon/lib/index.js:1906:19)
[15:02:50] Finished 'webpack' after 905 ms
我的版本
$ gulp -v
[16:09:58] CLI version 2.0.1
[16:09:58] Local version 3.9.1
如果有人可以提供建议,谢谢。