electron-vue 打包时遇到'resource busy or locked' 错误
我的工作用electron-vue开发一个简单的桌面应用,目前开发工作基本快完成了,第一次打包的时候还可以正常打包,也可以正常安装,但是在我发第二次打包的时候却遇到了这样的错误,之后我尝试各种方法也绕不过这个错误,打包失败:
Error: EBUSY: resource busy or locked, unlink 'C:\Users\me\Documents\GitHub\statistic\statistic\build\win-unpacked\resources\app.asar'
at C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder-lib\src\packager\dirPackager.ts:54:7
at Generator.next (<anonymous>)
From previous event:
at unpack (C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder-lib\out\packager\dirPackager.js:55:21)
at unpackElectron (C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder-lib\src\packager\dirPackager.ts:27:10)
at C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder-lib\src\platformPackager.ts:164:27
at Generator.next (<anonymous>)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
at WinPackager.doPack (C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder-lib\out\platformPackager.js:276:11)
at C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder-lib\src\platformPackager.ts:113:16
at Generator.next (<anonymous>)
From previous event:
at WinPackager.pack (C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder-lib\out\platformPackager.js:196:11)
at C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder-lib\src\packager.ts:364:24
at Generator.next (<anonymous>)
at xfs.stat (C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\fs-extra-p\node_modules\fs-extra\lib\mkdirs\mkdirs.js:56:16)
at C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\graceful-fs\polyfills.js:287:18
at FSReqWrap.oncomplete (fs.js:153:5)
From previous event:
at Packager.doBuild (C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder-lib\out\packager.js:432:11)
at C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder-lib\src\packager.ts:308:52
at Generator.next (<anonymous>)
at C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\graceful-fs\graceful-fs.js:99:16
at C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\graceful-fs\graceful-fs.js:43:10
at FSReqWrap.oncomplete (fs.js:135:15)
From previous event:
at Packager._build (C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder-lib\out\packager.js:376:11)
at C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder-lib\src\packager.ts:270:23
at Generator.next (<anonymous>)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
at Packager.build (C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder-lib\out\packager.js:332:11)
at C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder\src\builder.ts:310:40
at Generator.next (<anonymous>)
From previous event:
at _build (C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder\out\builder.js:61:21)
at build (C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder\src\builder.ts:280:10)
at then (C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder\src\cli\cli.ts:48:33)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
at Object.args [as handler] (C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder\src\cli\cli.ts:48:33)
at Object.runCommand (C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder\node_modules\yargs\lib\command.js:235:44)
at Object.parseArgs [as _parseArgs] (C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder\node_modules\yargs\yargs.js:1074:24)
at Object.get [as argv] (C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder\node_modules\yargs\yargs.js:989:21)
at Object.<anonymous> (C:\Users\me\Documents\GitHub\statistic\statistic\node_modules\electron-builder\src\cli\cli.ts:42:15)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
我用的打包工具是electron-builder, 最让我疑惑的是我第一次打包成功后,只是做了简单的修改,然后第二次打包就遇到了这个问题,感觉很没有思路。
github地址:https://github.com/zixusir/st...
谢谢!
希望国外的朋友也能支援一下,确实拖了太久啦。。。
my work is developing a desktop app by electron-vue. At present, most developing works have been finished. But after my first successfully package, I come across such above error, which says Error: EBUSY: resource busy or locked, unlink 'C:\Users\me\Documents\GitHub\statistic\statistic\build\win-unpacked\resources\app.asar'
it's my first time to develop a app by electron-vue, so I found few idea about this question.
the github repositoy of this project is https://github.com/zixusir/st...
thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
报这个错的原因是dist文件夹内的文件被其他进程占用, 此时你试图删除这个文件夹的话会报如下这个错误
这个报错相信大家都很熟悉了, 解决办法就是关闭占用这个文件夹的进程,
而我这里会出现这个问题是因为之前在dist文件夹里打开了cmd命令行窗口, 导致进程占用,
关掉后就可以了.
把 asar 档案当作一个普通的文件
https://github.com/electron/e...
是用VS Code开发吗?把VS Code关了就可以了
检查下有可能是一些安全软件在捣蛋,我在打包时就是被下面这个进程锁住了,找了好久才发现,每次打包前都得结束这个进程,但是还会在后台自动启动,已经跟阿里提交过这个问题,但是没人处理
我也遇到这个问题,特别是在运行 clean 命令之后会出现 Error: EBUSY,应该是线程被占用了,我这边打包 APP 是单独启动一个终端,然后先将 build 文件夹内对应生成的部分给删掉(clean 出了点 bug, build 文件夹中的 icons 文件夹别删了),(把占用的那个线程给干掉)再次 build 就行了,你也可以试试。
还有就是别把项目写在 C 盘,有时候权限不够,构建的时候会有问题