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.

resources/app folder has broken permissions

See original GitHub issue

The /resources/app folder can’t be deleted because its permissions are somehow broken. I get this error either by trying to package as an asar or when trying to overwrite a previous build when using the Programmatic API with electron-packager installed locally in the folder.

{ Error: EPERM: operation not permitted, rmdir 'D:\user\appNameFolder\appName-win32-x64\resources\app'
  at Error (native)
  errno: -4048,
  code: 'EPERM',
  syscall: 'rmdir',
  path: 'D:\\user\\appNameFolder\\appName-win32-x64\\resources\\app' }

When I use command line using the global package.

EPERM: operation not permitted, rmdir 'C:\Users\User\AppData\Local\Temp\electron-packager\win32-x64\appName-win32-x64\resources\app'

After this error occurs, I can delete the app folder myself but I can’t using the rmdir Windows command and it returns “Access is Denied”. If I check the permissions through the properties window it has the same settings as any other folder. I’m not sure what’s causing this error and I’ve tried investigating but haven’t gotten anywhere so far.

I figured it might be problem with npm but I’ve tried reinstalling npm and nodejs multiple times to no avail.

After the error occurs once with the command line, using it a second time will cause no console output. This can be fixed by deleting the AppData/Local/Temp/electron-packager folder. It gets stuck here because it doesn’t have permission to delete the app folder from the previous build.

Which version of electron-packager are you using?

7.0.4

What CLI arguments are you passing? Alternatively, if you are using the API, what parameters are you passing to the packager() function?

for the packager() function

const options = {
    platform: 'win32',
    arch: 'x64',
    dir: '.',
    version: '1.2.3',
    tmpdir: false,
    asar: true,
    overwrite: true
};

for the command line

electron-packager . --platform=win32 --arch=x64 --version=1.2.3

Although I have tried many other options with no success.

What version of Electron are you building with?

Tried 1.2.1 and 1.2.3

What is the host platform are you running electron-packager on?

Windows 10 x64

What target platform(s)/architecture(s) are you building for? win32 x64

Please provide either a failing testcase or detailed steps to reproduce your problem. Installing it both globally

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
jf908commented, Jun 21, 2016

Thank you everyone for the help, I finally solved the issue even although I think it wasn’t directly related to electron-packager.

I’m not sure how but the folder had been set to read-only. It took a while to realize this because I’ve never dealt with Windows permission issues before. Everything inside the folder was writable and setting it through the properties window had no effect.

I only found out that it was read-only by using ls in powershell and saw there was an r mode where there shouldn’t be. I fixed the issue using the command attrib -R appNameFolder.

0reactions
shockthetoastcommented, Jun 4, 2019

@binaryfunt Are you using SVN for your project? I ran into this issues while using TortoiseSVN for the project.

Recently I tried moving the .svn folder out of my project, then runing attrib -r /d /s on the project root. After that I was able to build repeatedly. (Before that, I had to run the attrib every time, as you stated.)

If I then move the .svn folder back in, it still works. The only explanation I can think of is that TortoiseSVN doesn’t like the .svn folder not being readonly, but it applies it in a way that affects the project folder. I’m really grasping at straws here, though.

At this point I am able to rebuild repeatedly without issue. Though if it is SVN, a project update may cause a regression. At the very least, I assume this would have to be done by anyone who checks out the project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Folder Permissions not working on some folders
I went to open the folder in C:\Windows\Temp and it said I do not have permission to open the folder even though I...
Read more >
broken file permissions - PowerShell - Spiceworks Community
I am facing an issue where there is a need to remove a BULK of old files and folders. The problem is, in...
Read more >
A Folder in Windows has lost all permissions, how can I fix or ...
I would first suggest running chkdsk /f on the disk, which will make sure the security information isn't corrupted.
Read more >
Permission Propagation: Info and Tips - Varonis
Because of permissions propagation, you expect that all folders in ... Broken permissions is a common data security issue and one that is...
Read more >
SharePoint Online: Check If a Folder has Unique Permissions
Check if Folder has Broken Permission Inheritance using PowerShell CSOM. When granting permissions to folders and files in SharePoint Online ...
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