electron / electron/forge

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

Open
#3,283 3 comments 0 reactions 0 assignees View on GitHub
bug platform/windows
Dominant language
TypeScript
Stars
7.1k
Forks
641
Avg merge
3d 1h
Merged PRs (30d)
30

Description

### Pre-flight checklist

- [X] I have read the [contribution documentation](https://github.com/electron/forge/blob/main/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.