Electron Builder Error: EBUSY: Resource Busy or Locked During Packaging
I’m encountering a persistent issue while building an Electron application using Angular 14, electron-builder, and related dependencies. Despite multiple attempts at troubleshooting, the error persists. Here are the details of my setup and the errors:
Environment
- Electron: ^21.3.0
- Electron Builder: 24.13.3
- Electron Packager: ^17.1.1
- Electron Wix MSI: ^5.0.0
- Angular: v14
Error Details
During the build process, I encounter the following errors:
Error #1 --------------------------------------------------------------------------------
Error: EBUSY: resource busy or locked, copyfile 'D:wamp64wwwVoffiseGitExternalvoffis_desktop_appsnode_modules@ampprojectremappingdistremapping.mjs.map' -> 'D:wamp64wwwVoffiseGitExternalvoffis_desktop_appsreleasewin-unpackedresourcesappnode_modules@ampprojectremapping'
Error #2 --------------------------------------------------------------------------------
Error: EBUSY: resource busy or locked, copyfile 'D:wamp64wwwVoffiseGitExternalvoffis_desktop_appsnode_modules@ampprojectremappingdistremapping.mjs' -> 'D:wamp64wwwVoffiseGitExternalvoffis_desktop_appsreleasewin-unpackedresourcesappnode_modules@ampprojectremapping'
Error #3 --------------------------------------------------------------------------------
Error: EBUSY: resource busy or locked, copyfile 'D:wamp64wwwVoffiseGitExternalvoffis_desktop_appsnode_modules@ampprojectremappingdistremapping.umd.js.map' -> 'D:wamp64wwwVoffiseGitExternalvoffis_desktop_appsreleasewin-unpackedresourcesappnode_modules@ampprojectremapping'
Error #4 --------------------------------------------------------------------------------
Error: EBUSY: resource busy or locked, open 'D:wamp64wwwVoffiseGitExternalvoffis_desktop_appsreleasewin-unpackedresourcesappnode_modules@ampprojectremapping' failedTask=build stackTrace=Error: Cannot cleanup:
Troubleshooting Steps Taken
-
Reinstalled node modules:
rm -rf node_modules npm install
-
Clean npm cache
npm cache clean --force
-
Restarted the PC to ensure no processes are holding onto the files.
-
Closed all applications to confirm no files are in use.
Despite these efforts, the issue persists.
Additional Information
- The errors occur during the packaging step when using electron-builder.
- The specific file causing the issue appears to be related to @ampprojectremapping.
Has anyone encountered a similar issue or have any insights on how to resolve this? Any help would be greatly appreciated!
I tried the following steps to resolve the issue:
-
Reinstalled node modules:
rm -rf node_modules npm install
- I expected this to ensure all dependencies are correctly installed and up-to-date.
- Cleaned npm cache:
npm cache clean --force
- I expected this to remove any potentially corrupted cache files that might be causing the issue.
- Restarted the PC to ensure no processes are holding onto the files.
- Closed all applications to confirm no files are in use.
Despite these efforts, the error persists. I was expecting these steps to resolve the file lock issue and allow the build process to complete successfully.
Henil Mehta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.