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:\wamp64\www\VoffiseGitExternal\voffis_desktop_apps\node_modules@ampproject\remapping\dist\remapping.mjs.map' -> 'D:\wamp64\www\VoffiseGitExternal\voffis_desktop_apps\release\win-unpacked\resources\app\node_modules@ampproject\remapping'
Error #2 --------------------------------------------------------------------------------
Error: EBUSY: resource busy or locked, copyfile 'D:\wamp64\www\VoffiseGitExternal\voffis_desktop_apps\node_modules@ampproject\remapping\dist\remapping.mjs' -> 'D:\wamp64\www\VoffiseGitExternal\voffis_desktop_apps\release\win-unpacked\resources\app\node_modules@ampproject\remapping'
Error #3 --------------------------------------------------------------------------------
Error: EBUSY: resource busy or locked, copyfile 'D:\wamp64\www\VoffiseGitExternal\voffis_desktop_apps\node_modules@ampproject\remapping\dist\remapping.umd.js.map' -> 'D:\wamp64\www\VoffiseGitExternal\voffis_desktop_apps\release\win-unpacked\resources\app\node_modules@ampproject\remapping'
Error #4 --------------------------------------------------------------------------------
Error: EBUSY: resource busy or locked, open 'D:\wamp64\www\VoffiseGitExternal\voffis_desktop_apps\release\win-unpacked\resources\app\node_modules@ampproject\remapping' failedTask=build stackTrace=Error: Cannot cleanup:
Troubleshooting Steps Taken
Reinstalled node modules:
rm -rf node_modules npm installClean npm cache
npm cache clean --forceRestarted 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 @ampproject\remapping.
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.
1 Answer 1
Create a .easignore file in the root of your project. Code:
# Visual Studio files
.vs/
*.vsidx
*.suo
*.user
*.userosscache
*.sln.docstates
# IDE files
.vscode/
.idea/
# OS files
.DS_Store
Thumbs.db
# Temporary files
*.tmp
*.temp
# Node modules (already ignored by default, but just in case)
node_modules/
# Build outputs
dist/
build/
Comments
Explore related questions
See similar questions with these tags.