Electron Forge - Error: EBUSY: resource busy or locked, rmdir 'path'

Electron Forge - Error: EBUSY: resource busy or locked, rmdir 'path'

当运行npm run package时,出现如下错误:

An unhandled rejection has occurred inside Forge:
[Error: EBUSY: resource busy or locked, rmdir 'D:\Repos\app\out\app-win32-x64'] {
  errno: -4082,
  code: 'EBUSY',
  syscall: 'rmdir',
  path: 'D:\Repos\app\out\app-win32-x64'
}

Electron Forge was terminated. Location:
{}

是什么导致了这个错误,如何解决?

也许您忘记调用 app.quit() 并且 app.exe 仍在后台 运行,杀死所有 app.exe 实例然后重试,错误应该消失了。