MacOs: Fail to delete `.asar` files.
See original GitHub issueAttempting to use del to remove .app files of electron apps fails with ENOTEMPTY for .asar files only.
Currently I’m working around this manually invoking rm on mac for those files prior to a full del on the target app file. I assume it’s something to do with .asar files being treated somewhat as folder on Mac?
(I havent tested the behaviour on other platforms as yet).
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How to Delete Files on Mac that Won't Delete - EaseUS
Step 1. Press these three keys together: Option + Command + Esc (Escape). Or choose Force Quit from the Apple menu in the...
Read more >How to Delete Files from Your Mac that Won't Delete
Try Force Delete. If all else fails, you can force-delete the file using a Terminal command. Just be aware that force-delete doesn't send...
Read more >How to reduce electron apps size - Stack Overflow
1 Answer 1 · Yes I ran this command to unpack the file but it gives an error in the terminal saying "ENOENT:...
Read more >Application Packaging | Electron
Then execute Electron.app on macOS, electron on Linux, or electron.exe on ... app by copying all of its source files, you can package...
Read more >Options | electron-packager
Functions to be called after your app directory has been packaged into an .asar file. Note: afterAsar will only be called if the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

After writing the lines above I was able to find the solution in the electron docs which state that
With special patches in Electron, Node APIs like fs.readFile and require treat asar archives as virtual directories, and the files in it as normal files in the filesystem.However, there is also a section in the docs explaining how to disable this special treatment of asar files: Treating an asar Archive as a Normal File.I was able to get everything working with the following lines:
life saver!