Forge makers on Windows create a platform-dependent issue during update.
Pre-flight checklist
- [X] I have read the contribution documentation for this project.
- [X] I agree to follow the code of conduct that this project uses.
- [X] I have searched the issue tracker for a bug that matches the one I want to file, without success.
Electron Forge version
6.2.1
Electron version
25.3.2
Operating system
Windows 11 (22621)
Last known working Electron Forge version
No response
Expected behavior
My expectation is that when I type npm update I should receive something like the following:
changed 1 package, and audited 738 packages in 29s
116 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Actual behavior
The output of the command is as follows:
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup [
npm WARN cleanup 'C:\\My\\app\\directory\\node_modules\\electron-installer-redhat',
npm WARN cleanup [Error: EPERM: operation not permitted, rmdir 'C:\My\app\directory\node_modules\electron-installer-redhat\node_modules\yargs-parser'] {
npm WARN cleanup errno: -4048,
npm WARN cleanup code: 'EPERM',
npm WARN cleanup syscall: 'rmdir',
npm WARN cleanup path: 'C:\\My\\app\\directory\\node_modules\\electron-installer-redhat\\node_modules\\yargs-parser'
npm WARN cleanup }
npm WARN cleanup ]
npm WARN cleanup ]
changed 1 package, and audited 738 packages in 29s
116 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Steps to reproduce
This happens on a fresh install with the webpack template every time (and I at first thought it might be the template). But when I upgrade an existing project to Forge through the CLI, without the template, precisely the same issue occurs, and persists.
Reliable reproduction
-
npm init electron-app@latest _directory_ -- --template=webpack - cd directory
-
npm update -
npm update(2nd time)
Reproducible, but spotty results
-
npm i --save-dev @electron-forge/cli -
npm exec --package=@electron-forge/cli -c "electron-forge import" -
npm update -
npm update(a 2nd time)
Additional information
I use Windows PowerShell v. 7, should that prove to be any part of the issue.
So, the really maddening parts:
- Without the webpack template, It only happens with the CLI import.
- It happens even after I've removed
@electron-forge/cli - It persists until all vestiges of Electron are removed through
npm remove xxxx-pkg. - It does not occur on the install of
electronby itself. - Attempting to install
electron-installer-redhatproduces the expected messages about it being the wrong platform. - There is not, and never was, any
electron-installer-redhatdirectory, perms or not. - There is also not
electron-installer-debor any other non-Windows package, which is also listed in my dev dependencies for the project.
I do hope I've offered enough of the right information to investigate this. I will check back to address any further information requests.
So, investigating this further, removing @Electron-Forge/maker-xxx (for anything not on Windows) removed the notice.
So, that's at least a workaround, and an indicator of where the problem is. But it doesn't remove the actual issue.
Changed the title to a more descriptive indicator of what I can discern of the issue.
I'm currently having the same issue with the flatpak maker with both @malept\electron-installer-flatpak\node_modules\cliui and @malept\flatpak-bundler\node_modules\fs-extra throwing an EPERM with rmdir.
It only happens on Windows, but it makes development difficult, as both Windows and Fedora are used for development.