正常写的业务逻辑,未作配置, npm run build失败
我这边也报了同样的错误。
昨天build没问题,今天改了几个API接口地址,别的什么都没改,build就报错了。
npm strat没问题。也没更新过任何东西,不太确定问题出在哪里。
详细的log:


同样也是,之前还能正常打包的。今天打包不知道怎么回事
@walkinMrwang 我发现我的报错信息跟你一模一样
我的报这样的错误
E:\barcoder-web>npm run build
[email protected] build E:\barcoder-web
roadhog build
Creating an optimized production build...
Failed to compile.
index.js from UglifyJs
Unexpected token name «i», expected punc «;» [index.js:86711,10]
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: roadhog build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\SFY\AppData\Roaming\npm-cache_logs\2018-03-15T02_28_08_965Z-debug.log
详细的log
0 info it worked if it ends with ok
1 verbose cli [ 'D:\node\node.exe',
1 verbose cli 'D:\node\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 info lifecycle [email protected]~build: [email protected]
7 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~build: PATH: D:\node\node_modules\npm\bin\node-gyp-bin;E:\barcoder-web\node_modules.bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;D:\node\;C:\Program Files\Git\cmd;C:\Users\SFY\AppData\Local\Microsoft\WindowsApps;;D:\Microsoft VS Code\bin;C:\Users\SFY\AppData\Roaming\npm;C:\Users\SFY\AppData\Local\Programs\Fiddler
9 verbose lifecycle [email protected]~build: CWD: E:\barcoder-web
10 silly lifecycle [email protected]~build: Args: [ '/d /s /c', 'roadhog build' ]
11 silly lifecycle [email protected]~build: Returned: code: 1 signal: null
12 info lifecycle [email protected]~build: Failed to exec build script
13 verbose stack Error: [email protected] build: roadhog build
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.
13 verbose stack at emitTwo (events.js:125:13)
13 verbose stack at EventEmitter.emit (events.js:213:7)
13 verbose stack at ChildProcess.
13 verbose stack at emitTwo (events.js:125:13)
13 verbose stack at ChildProcess.emit (events.js:213:7)
13 verbose stack at maybeClose (internal/child_process.js:927:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
14 verbose pkgid [email protected]
15 verbose cwd E:\barcoder-web
16 verbose Windows_NT 10.0.16299
17 verbose argv "D:\node\node.exe" "D:\node\node_modules\npm\bin\npm-cli.js" "run" "build"
18 verbose node v8.4.0
19 verbose npm v5.3.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] build: roadhog build
22 error Exit status 1
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
调试了半天,发现是自己的锅。
使用vscode输入div时,自动引入了:
import { div } from 'gl-matrix/src/gl-matrix/vec4'
报错的ARRAY_TYPE就是gl-matrix源码里的,导致了UglifyJs压缩失败。
去掉这个就好了,不知道能否解决你们的问题。 @LKCheng @walkinMrwang
厉害了,大兄弟。我用了比较笨的办法,之前能打包成功的,回退版本一直在对比文件,也是发现了在多出了 import { ARRAY_TYPE } from 'gl-matrix/src/gl-matrix/common'; 导致打包失败的
对的也我同样解决了,我是挨个注释文件,发现有个这个文件
我也是一样的问题,不过我改了很多代码了。没办法注释的方式找错。你们上面的信息我都git grep "xx" 都没有找到。求解决思路呀 @walkinMrwang @LKCheng @lwd369
如果报错一样直接全文搜索 import { ARRAY_TYPE } from 'gl-matrix/src/gl-matrix/common'; ?

我是这个报错:Unexpected token: name (Mime)
引用的包不规范的原因。。。
@chenshuai2144 那这个包需要按照什么样的规范来做呢, 这个第三方库是纯es6语法的
同样的报错,由于引入了这个:
import { div } from 'gl-matrix/src/gl-matrix/vec4' 导致了UglifyJs压缩失败,把这个删除就打包成功了
Most helpful comment
https://github.com/sorrycc/blog/issues/68