Vue npm run build打包时uglifyjs报错TypeError: requestShortener.shorten is not a function

报错的日志:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\Administrator.WIN10-711081256\\AppData\\Roaming\\npm\\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: C:\Users\Administrator.WIN10-711081256\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;E:\IdeaWorkspace\meteoVue\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Java\jdk1.7.0_80\bin;C:\ProgramData\Anaconda3;C:\ProgramData\Anaconda3\Library\mingw-w64\bin;C:\ProgramData\Anaconda3\Library\usr\bin;C:\ProgramData\Anaconda3\Library\bin;C:\ProgramData\Anaconda3\Scripts;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\MySQL\MySQL Server 5.7\bin;C:\Program Files\nodejs\;D:\maven\apache-maven-3.5.2\bin;C:\Program Files\Git\cmd;C:\Program Files\TortoiseSVN\bin;E:\gradle-3.5-all\gradle-3.5\bin;D:\matlab\matlab2015b\polyspace\bin;C:\Program Files (x86)\Brackets\command;D:\matlab\matlab2015b\runtime\win64;D:\matlab\matlab2015b\bin;C:\Users\Administrator.WIN10-711081256\AppData\Local\Programs\Python\Python36-32\Scripts\;C:\Users\Administrator.WIN10-711081256\AppData\Local\Programs\Python\Python36-32\;C:\Users\Administrator.WIN10-711081256\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator.WIN10-711081256\AppData\Roaming\npm;C:\Users\Administrator.WIN10-711081256\AppData\Local\GitHubDesktop\bin
9 verbose lifecycle [email protected]~build: CWD: E:\IdeaWorkspace\meteoVue
10 silly lifecycle [email protected]~build: Args: [ '/d /s /c', 'node build/build.js' ]
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: `node build/build.js`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter. (C:\Users\Administrator.WIN10-711081256\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:285:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess. (C:\Users\Administrator.WIN10-711081256\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:925:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid [email protected]
15 verbose cwd E:\IdeaWorkspace\meteoVue
16 verbose Windows_NT 10.0.16299
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Administrator.WIN10-711081256\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v8.9.1
19 verbose npm  v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] build: `node build/build.js`
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 ]

经过和其它的项目对比,发现:

把package.json里面的

"engines": {
  "node": ">= 4.0.0",
  "npm": ">= 3.0.0"
}
改成

"engines": {
  "node": ">= 6.0.0",
  "npm": ">= 3.0.0"
}
就行了,貌似是node的版本问题,具体原因我也不清楚(无奈?)

你可能感兴趣的:(Vue)