学习 vue 打包报错 vue cli npm run build code ELIFECYCLE

2020-06-01 00:00:14 +08:00
 ecai
npm run start 是正常的
1.尝试过 delete package-lock.json & node_modules and then rerun npm install and npm run build.
2.猜测是 CSS 编译错误

npm ERR! errno 1
npm ERR! socialsport@1.0.0 build: `node build/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the socialsport@1.0.0 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\cai_e\AppData\Roaming\npm-cache\_logs\2020-05-31T15_56_35_023Z-debug.log

详细 log
0 info it worked if it ends with ok
1 verbose cli [ 'D:\\nodeJs\\node.exe',
1 verbose cli 'D:\\nodeJs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using npm@6.4.1
3 info using node@v10.15.3
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle socialsport@1.0.0~prebuild: socialsport@1.0.0
6 info lifecycle socialsport@1.0.0~build: socialsport@1.0.0
7 verbose lifecycle socialsport@1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle socialsport@1.0.0~build: PATH: D:\nvm\v10.15.3\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\social\web\node_modules\.bin;D:\Xshell 6\;D:\Python3\Scripts\;D:\Python3\;C:\Program Files (x86)\Razer\ChromaBroadcast\bin;C:\Program Files\Razer\ChromaBroadcast\bin;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Users\cai_e\AppData\Local\Microsoft\WindowsApps;E:\work\erl8.1\bin;D:\TortoiseSVN\bin;E:\work\Git\cmd;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;D:\TortoiseGit\bin;D:\nvm;D:\nodeJs;C:\Program Files\MySQL\MySQL Shell 8.0\bin\;C:\Users\cai_e\AppData\Local\Programs\Python\Python37\Scripts\;C:\Users\cai_e\AppData\Local\Programs\Python\Python37\;C:\Users\cai_e\AppData\Local\Microsoft\WindowsApps;D:\Microsoft VS Code\bin;C:\Users\cai_e\AppData\Local\GitHubDesktop\bin;D:\nvm;D:\nodeJs;C:\Program Files\MySQL\MySQL Server 8.0\bin;
9 verbose lifecycle socialsport@1.0.0~build: CWD: D:\social\web
10 silly lifecycle socialsport@1.0.0~build: Args: [ '/d /s /c', 'node build/build.js' ]
11 silly lifecycle socialsport@1.0.0~build: Returned: code: 1 signal: null
12 info lifecycle socialsport@1.0.0~build: Failed to exec build script
13 verbose stack Error: socialsport@1.0.0 build: `node build/build.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (D:\nvm\v10.15.3\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:189:13)
13 verbose stack at ChildProcess.<anonymous> (D:\nvm\v10.15.3\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:189:13)
13 verbose stack at maybeClose (internal/child_process.js:970:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid socialsport@1.0.0
15 verbose cwd D:\social\web
16 verbose Windows_NT 10.0.18362
17 verbose argv "D:\\nodeJs\\node.exe" "D:\\nodeJs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v10.15.3
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error socialsport@1.0.0 build: `node build/build.js`
22 error Exit status 1
23 error Failed at the socialsport@1.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
2344 次点击
所在节点    JavaScript
3 条回复
ecai
2020-06-01 00:08:50 +08:00
一个一个 CSS 的排除,找到了
MuscleOf2016
2020-06-01 00:28:07 +08:00
虽然帖子发的不怎么样,还是支持下自己解决问题,一定很开心吧。
ecai
2020-06-01 00:38:15 +08:00
@MuscleOf2016
:) 哈哈,当时很急,到处都看了. 就随手把错误贴上来了.
等我后面修正一下

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/677316

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX