question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MacOs: Fail to delete `.asar` files.

See original GitHub issue

Attempting 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:open
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
pascalbayercommented, Jun 22, 2020

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:

process.noAsar = true;
await del(pathToExecutable, {
    force: true
});
process.noAsar = false;
0reactions
rahul-dutt-sharmacommented, Sep 27, 2022

life saver!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found