V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐关注
Meteor
JSLint - a JavaScript code quality tool
jsFiddle
D3.js
WebStorm
推荐书目
JavaScript 权威指南第 5 版
Closure: The Definitive Guide
ecai
V2EX  ›  JavaScript

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

  •  
  •   ecai · 2020-06-01 00:00:14 +08:00 · 2573 次点击
    这是一个创建于 1672 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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! [email protected] build: `node build/build.js`
    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\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 [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:\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 [email protected]~build: CWD: D:\social\web
    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.<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 [email protected]
    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 [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 ]
    第 1 条附言  ·  2020-06-01 00:37:45 +08:00
    Vue 项目打包成移动端 APP
    在 npm run build 一直提示报错.
    因为 npm run start 是正常,网页上测试也可以
    错误信息就贴到上面了.
    看过 issues 建议是清理 package-lock.json & node_modules
    各大网站都找了快 1 小时了.
    后面检查到 css 异常

    其实还是没懂怎么看这个错误日志
    3 条回复    2020-06-01 00:38:15 +08:00
    ecai
        1
    ecai  
    OP
       2020-06-01 00:08:50 +08:00
    一个一个 CSS 的排除,找到了
    MuscleOf2016
        2
    MuscleOf2016  
       2020-06-01 00:28:07 +08:00
    虽然帖子发的不怎么样,还是支持下自己解决问题,一定很开心吧。
    ecai
        3
    ecai  
    OP
       2020-06-01 00:38:15 +08:00
    @MuscleOf2016
    :) 哈哈,当时很急,到处都看了. 就随手把错误贴上来了.
    等我后面修正一下
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2788 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 12:31 · PVG 20:31 · LAX 04:31 · JFK 07:31
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.