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

2020-06-30 11:32:58 +08:00
 TomVista

错误和日志

build 出来的东西有几个 js error

PS C:\Users\tomvi\Desktop\app> npm run mp

> app@0.1.0 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! app@0.1.0 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 app@0.1.0 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 npm@6.9.0
3 info using node@v10.16.3
4 verbose run-script [ 'premp', 'mp', 'postmp' ]
5 info lifecycle app@0.1.0~premp: app@0.1.0
6 info lifecycle app@0.1.0~mp: app@0.1.0
7 verbose lifecycle app@0.1.0~mp: unsafe-perm in lifecycle true
8 verbose lifecycle app@0.1.0~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 app@0.1.0~mp: CWD: C:\Users\tomvi\Desktop\app
10 silly lifecycle app@0.1.0~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 app@0.1.0~mp: Returned: code: 1  signal: null
12 info lifecycle app@0.1.0~mp: Failed to exec mp script
13 verbose stack Error: app@0.1.0 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 app@0.1.0
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 app@0.1.0 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 app@0.1.0 mp script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

2464 次点击
所在节点    Vue.js
5 条回复
onfuns
2020-06-30 14:17:11 +08:00
权限不够,右键命令行工具管理员运行。
TomVista
2020-06-30 15:20:55 +08:00
@onfuns 即使使用管理员权限,也会出现这个情况, 甚至有时候,再次执行这个命令,能 buid 过,:dog
maojy1989
2020-06-30 16:50:30 +08:00
用 npm cache clean --force 清除缓存然后删除 node_modules 跟 package-lock.json 再重新安装试试
96412hj
2020-07-02 10:03:23 +08:00
你是不是吧 package.lock.json 删了
TomVista
2020-07-02 10:27:03 +08:00
@96412hj 没有,我尝试了删除 package.lock.json, 重新 npm i,不行,还是这个样子

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

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

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

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

© 2021 V2EX