【Electron-builder】“The process cannot access the file because it is being used by another process.”

在用 electron-builder 打包时,时常会出现 “The process cannot access the file because it is being used by another process.” 这个报错,字面意思是因另一个进程在使用文件,因此如今不能操做此文件。报错如图:json

因为这个报错是偶尔发生的,排除了好久才解决,故作下笔记。服务器

网上的方法

vscode "设置" 里排除掉 "win-unpacked" 文件夹的监测electron

{
  "files.watcherExclude": {
    "**/build/win-unpacked/**": true
  }
}

理由是 vscode 会检测项目文件的变化,然而按照此方法设置了依旧仍是会报错。因此根本缘由不在此。。ui

解决

不启用 “live server” 插件!插件

由于项目要作自动更新,图个方便,开启了 “live server” 服务,因为此插件就像一个服务器,已开启就会检测项目的根目录,开启后,即便再关闭,其检测文件的进程依旧存在,这是就须要重启 vscode 了。code

相关文章
相关标签/搜索