forge icon indicating copy to clipboard operation
forge copied to clipboard

Forge makers on Windows create a platform-dependent issue during update.

Open VishwaJay opened this issue 2 years ago • 3 comments

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

  1. npm init electron-app@latest _directory_ -- --template=webpack
  2. cd directory
  3. npm update
  4. npm update (2nd time)

Reproducible, but spotty results

  1. npm i --save-dev @electron-forge/cli
  2. npm exec --package=@electron-forge/cli -c "electron-forge import"
  3. npm update
  4. 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:

  1. Without the webpack template, It only happens with the CLI import.
  2. It happens even after I've removed @electron-forge/cli
  3. It persists until all vestiges of Electron are removed through npm remove xxxx-pkg.
  4. It does not occur on the install of electron by itself.
  5. Attempting to install electron-installer-redhat produces the expected messages about it being the wrong platform.
  6. There is not, and never was, any electron-installer-redhat directory, perms or not.
  7. There is also not electron-installer-deb or 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.

VishwaJay avatar Jul 28 '23 18:07 VishwaJay

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.

VishwaJay avatar Jul 29 '23 16:07 VishwaJay

Changed the title to a more descriptive indicator of what I can discern of the issue.

VishwaJay avatar Jul 29 '23 16:07 VishwaJay

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.

LauraWebdev avatar Mar 17 '25 14:03 LauraWebdev