forge: [electron-forge make] EPERM: operation not permitted, rmdir.
Pre-flight checklist
- I have read the contribution documentation for this project.
- I agree to follow the code of conduct that this project uses.
- I have searched the issue tracker for a bug that matches the one I want to file, without success.
Electron Forge version
7.2.0
Electron version
28.0.0
Operating system
Windows 11 Home
Last known working Electron Forge version
No response
Expected behavior
Be able to use electron-forge make / npm without EPERM errors.
Actual behavior
I am attempting to follow the “Quick Start > Package and distribute your application” guide provided by the Electron documentation. However, I am encountering the following error: EPERM: operation not permitted, rmdir ‘C:\Users\user\AppData\Local\Temp\electron-packager\tmp-u5kZtS\resources\app\node_modules.electron-vy9FvFgv\dist’.
Steps to reproduce
npm run make
or
npx electron-forge make
Additional information
I have explored various solutions to address this issue, including:
- Running the process both as an administrator and a regular user.
- Executing
npm cache clean --forceandnpm cache verify. - Changing the TEMP path to a location on a non-system drive.
- Rebooting the computer under different states.
- Attempting the use of
YARN, resulting in the same error. - Adjusting versions of
Node,NPM, andelectron-forgewith combinations such as:Node: v21.5.0, v20.10.0, v18.19.0, v9.11.2.NPM: v10.2.3, v4.x.x, v5.x.x.Electron-forge: v6.0.x.
To resolve the issue, I attempted to delete the empty folder created by electron-forge in the TEMP directory using rmdir "path" as specified in an error. However, I encountered the error Access is denied., being an administrator with the necessary permissions. Using rmdir /s /q "path" successfully removes a folder. I’m concerned that a library might be incorrectly using a command to delete a directory.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 22 (1 by maintainers)
Any update on this issue? I am using WSL to package builds for now!!
Facing same issue when using
packagecommandI don’t want to push it, but I think the problem might be Node.
I just changed remove to
removeSync()in my example above and the folder was successfully removed.I looked at the
fs-extrasrepo (used in electron-forge) and I didn’t see anything else between them, in the end it’s a call to the Node defaultfs.I played around with my
node_modulesand changed all the references fromfs.remove()tofs.removeSync()in theelectron-packagefolders, and magically the build worked correctly. 🚀What I still don’t understand is why some repositories (using the same versions of dependencies) work and others don’t, even on the same machine. And why it started happening out of the blue.
For some reason (without having changed anything) make stopped working. Even in the version that used to work.
What I realized is that the directory:
%temp%\electron-packager\win32-x64\Appxxxxx\resources\appis created with some protection or limitation, that I can’t even remove the folder by running a simple delete script via node:All other files and folders are removed, except
\appNo updates.