V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
TomVista
V2EX  ›  Vue.js

vuecli 出错,找不到问题,帮忙看一下

  •  
  •   TomVista · 2020-06-30 11:32:58 +08:00 · 2466 次点击
    这是一个创建于 1606 天前的主题,其中的信息可能已经有所发展或是发生改变。

    错误和日志

    build 出来的东西有几个 js error

    PS C:\Users\tomvi\Desktop\app> npm run mp
    
    > [email protected] mp C:\Users\tomvi\Desktop\app
    > cross-env MP_ENV=miniprogram vue-cli-service build --mode development --dest ./dist/mp/common --watch
    
    vue.config
    
    /  Building for development...
    dependencies has been built
    
     ERROR  Build failed with errors.
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! [email protected] mp: `cross-env MP_ENV=miniprogram vue-cli-service build --mode development --dest ./dist/mp/common --watch`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the [email protected] mp 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\tomvi\AppData\Roaming\npm-cache\_logs\2020-06-30T03_29_00_880Z-debug.log   
    PS C:\Users\tomvi\Desktop\app>
    

    C:\Users\tomvi\AppData\Roaming\npm-cache_logs\2020-06-30T03_29_00_880Z-debug.log

    0 info it worked if it ends with ok
    1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
    1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
    1 verbose cli   'run',
    1 verbose cli   'mp' ]
    2 info using [email protected]
    3 info using [email protected]
    4 verbose run-script [ 'premp', 'mp', 'postmp' ]
    5 info lifecycle [email protected]~premp: [email protected]
    6 info lifecycle [email protected]~mp: [email protected]
    7 verbose lifecycle [email protected]~mp: unsafe-perm in lifecycle true
    8 verbose lifecycle [email protected]~mp: PATH: C:\Users\tomvi\AppData\Roaming\nvm\v10.16.3\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\tomvi\Desktop\app\node_modules\.bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;%NVM_HOME%;%NVM_SYMLINK%;C:\Program Files\Git\cmd;C:\Users\tomvi\AppData\Local\Microsoft\WindowsApps;C:\Users\tomvi\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\tomvi\AppData\Roaming\nvm;C:\Program Files\nodejs
    9 verbose lifecycle [email protected]~mp: CWD: C:\Users\tomvi\Desktop\app
    10 silly lifecycle [email protected]~mp: Args: [ '/d /s /c',
    10 silly lifecycle   'cross-env MP_ENV=miniprogram vue-cli-service build --mode development --dest ./dist/mp/common --watch' ]
    11 silly lifecycle [email protected]~mp: Returned: code: 1  signal: null
    12 info lifecycle [email protected]~mp: Failed to exec mp script
    13 verbose stack Error: [email protected] mp: `cross-env MP_ENV=miniprogram vue-cli-service build --mode development --dest ./dist/mp/common --watch`
    13 verbose stack Exit status 1
    13 verbose stack     at EventEmitter.<anonymous> (C:\Users\tomvi\AppData\Roaming\nvm\v10.16.3\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
    13 verbose stack     at EventEmitter.emit (events.js:198:13)
    13 verbose stack     at ChildProcess.<anonymous> (C:\Users\tomvi\AppData\Roaming\nvm\v10.16.3\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
    13 verbose stack     at ChildProcess.emit (events.js:198:13)
    13 verbose stack     at maybeClose (internal/child_process.js:982:16)
    13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
    14 verbose pkgid [email protected]
    15 verbose cwd C:\Users\tomvi\Desktop\app
    16 verbose Windows_NT 10.0.18362
    17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "mp"
    18 verbose node v10.16.3
    19 verbose npm  v6.9.0
    20 error code ELIFECYCLE
    21 error errno 1
    22 error [email protected] mp: `cross-env MP_ENV=miniprogram vue-cli-service build --mode development --dest ./dist/mp/common --watch`
    22 error Exit status 1
    23 error Failed at the [email protected] mp 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-30 17:24:29 +08:00
    不用 vue/cli,用框架给的 webpack 配置,避免了这个问题
    5 条回复    2020-07-02 10:27:03 +08:00
    onfuns
        1
    onfuns  
       2020-06-30 14:17:11 +08:00
    权限不够,右键命令行工具管理员运行。
    TomVista
        2
    TomVista  
    OP
       2020-06-30 15:20:55 +08:00
    @onfuns 即使使用管理员权限,也会出现这个情况, 甚至有时候,再次执行这个命令,能 buid 过,:dog
    maojy1989
        3
    maojy1989  
       2020-06-30 16:50:30 +08:00
    用 npm cache clean --force 清除缓存然后删除 node_modules 跟 package-lock.json 再重新安装试试
    96412hj
        4
    96412hj  
       2020-07-02 10:03:23 +08:00
    你是不是吧 package.lock.json 删了
    TomVista
        5
    TomVista  
    OP
       2020-07-02 10:27:03 +08:00
    @96412hj 没有,我尝试了删除 package.lock.json, 重新 npm i,不行,还是这个样子
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1036 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 19:21 · PVG 03:21 · LAX 11:21 · JFK 14:21
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.