Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Git Bash, "electron-forge make" will create folders in the temp directory but will not be able to remove them (failing the command) #3389

Closed
3 tasks done
justinfarrelldev opened this issue Oct 25, 2023 · 3 comments
Labels

Comments

@justinfarrelldev
Copy link

justinfarrelldev commented Oct 25, 2023

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

6.4.2

Electron version

24.8.5

Operating system

Windows 11 22H2 (22621.2361)

Last known working Electron Forge version

6.4.2

Expected behavior

A successful output from electron-forge make --platform=win32 (using Squirrel).

Actual behavior

❯ npm run make

> [email protected] make
> env-cmd -f .env.production rm -rf .vite && electron-forge make --platform=win32

✔ Checking your system
✔ Loading configuration
✔ Resolving make targets
  › Making for the following targets: squirrel
❯ Running package command
  ✔ Preparing to package application
  ✔ Running packaging hooks
    ✔ Running generateAssets hook
    ✔ Running prePackage hook
  ❯ Packaging application
    ❯ Packaging for x64 on win32
      ✖ Copying files
        › EPERM: operation not permitted, rmdir 'C:\tmp\electron-packager\win32-x64\ctp-mod-manager-win32-x64-d1Tm1y\resources\app\src\components'
      ◼ Preparing native dependencies
      ◼ Finalizing package
  ◼ Running postPackage hook
◼ Running preMake hook
◼ Making distributables
◼ Running postMake hook

An unhandled rejection has occurred inside Forge:
Error: EPERM: operation not permitted, rmdir 'C:\tmp\electron-packager\win32-x64\app-win32-x64-d1Tm1y\resources\app\src\components'

This happens whether or not I am using env-cmd, and this tmp directory was created fresh (so there was definitely no interference from elevated command prompts, etc). This is just using straight Git Bash, non-elevated through the VS Code integrated terminal (with VS Code not being elevated, either). The components folder is also not empty.

Steps to reproduce

I am using the Vite-Typescript preset.

This is my full make command copied from package.json:

    "make": "env-cmd -f .env.production rm -rf .vite && electron-forge make --platform=win32"

Here is my forge.config.ts:

module.exports = {
  makers: [
    {
      name: '@electron-forge/maker-squirrel',
      config: {},
    },
  ],
  packagerConfig: {
    ignore: ['^\\/public$', '^\\/node_modules$', '^\\/.github$'],
    asar: true,
    tmpdir: 'C:\\tmp',
    overwrite: true,
  },
};

I used overwrite, asar and tmpdir each to try to fix this issue (with none of them fixing it).

Additional information

Output of debug:

❯ DEBUG=electron-forge:* npm run make

> [email protected] make
> env-cmd -f .env.production rm -rf .vite && electron-forge make --platform=win32

⠋ Checking your system
✔ Checking your system
[STARTED] Loading configuration
  electron-forge:project-resolver searching for project in: C:\Users\justin.farrell\Documents\app +0ms
  electron-forge:project-resolver package.json with forge dependency found in C:\Users\justin.farrell\Documents\app\package.json +3ms
[SUCCESS] Loading configuration
[STARTED] Resolving make targets
  electron-forge:require-search searching [
  '@electron-forge/maker-squirrel',
  'C:\\Users\\justin.farrell\\Documents\\app\\@electron-forge\\maker-squirrel',
  'C:\\Users\\justin.farrell\\Documents\\app\\node_modules\\@electron-forge\\maker-squirrel'
] relative to C:\Users\justin.farrell\Documents\app +0ms
  electron-forge:require-search testing @electron-forge/maker-squirrel +1ms
[DATA] Making for the following targets: squirrel
[SUCCESS] Resolving make targets
[STARTED] Running package command
[STARTED] Preparing to package application
  electron-forge:project-resolver searching for project in: C:\Users\justin.farrell\Documents\app +1s
  electron-forge:project-resolver package.json with forge dependency found in C:\Users\justin.farrell\Documents\app\package.json +4ms
[SUCCESS] Preparing to package application
[STARTED] Running packaging hooks
[STARTED] Running generateAssets hook
[SUCCESS] Running generateAssets hook
[STARTED] Running prePackage hook
[SUCCESS] Running prePackage hook
[SUCCESS] Running packaging hooks
[STARTED] Packaging application
[DATA] Determining targets...
  electron-forge:packager packaging with options {
  asar: true,
  overwrite: true,
  ignore: [ '^\\/public$', '^\\/node_modules$', '^\\/.github$' ],
  tmpdir: 'C:\\tmp',
  quiet: true,
  dir: 'C:\\Users\\justin.farrell\\Documents\\app',
  arch: 'x64',
  platform: 'win32',
  afterFinalizePackageTargets: [ [AsyncFunction (anonymous)] ],
  afterComplete: [ [AsyncFunction (anonymous)] ],
  afterCopy: [ [AsyncFunction (anonymous)] ],
  afterExtract: [ [AsyncFunction (anonymous)] ],
  afterPrune: [ [AsyncFunction (anonymous)] ],
  out: 'C:\\Users\\justin.farrell\\Documents\\app\\out',
  electronVersion: '24.8.5'
} +0ms
  electron-forge:packager targets: [ { platform: 'win32', arch: 'x64' } ] +5ms
[STARTED] Packaging for x64 on win32
[STARTED] Copying files
[FAILED] EPERM: operation not permitted, rmdir 'C:\tmp\electron-packager\win32-x64\app-win32-x64-d1Tm1y\resources\app\src\components'
[FAILED] EPERM: operation not permitted, rmdir 'C:\tmp\electron-packager\win32-x64\app-win32-x64-d1Tm1y\resources\app\src\components'
[FAILED] EPERM: operation not permitted, rmdir 'C:\tmp\electron-packager\win32-x64\app-win32-x64-d1Tm1y\resources\app\src\components'
[FAILED] EPERM: operation not permitted, rmdir 'C:\tmp\electron-packager\win32-x64\app-win32-x64-d1Tm1y\resources\app\src\components'

An unhandled rejection has occurred inside Forge:
Error: EPERM: operation not permitted, rmdir 'C:\tmp\electron-packager\win32-x64\app-win32-x64-d1Tm1y\resources\app\src\components'

The rest of the asked-for info is in the "Steps to reproduce" section. I have also tried using npm ci a few times to no avail.

@justinfarrelldev
Copy link
Author

justinfarrelldev commented Oct 25, 2023

Edit: I found the issue within this reproduction and it was not related.

I have managed to reproduce this on a fresh vite-typescript template here: https://github.com/justinfarrelldev/minimal-repro

I have been using Git Bash specifically for this, not sure if it will reproduce on other terminals. The version of git reported within Git Bash is this: git version 2.42.0.windows.1 (I am not sure if there is another way to report a version of Git Bash's terminal specifically)

@erikian erikian added the blocked/needs-repro Issues unable to be reproduced by maintainers label Oct 26, 2023
@erikian
Copy link
Member

erikian commented Oct 26, 2023

I couldn't reproduce the issue, could you provide another repro? From the logs you've provided, looks like you can hit this error just with electron-forge package instead of electron-forge make — this would help limit the issue scope.

Are you using Git Bash somewhere else along the process (e.g. to run create-electron-app or to create the tmp directory) or are you just trying to make/package the app with it?

@justinfarrelldev
Copy link
Author

I couldn't reproduce the issue, could you provide another repro? From the logs you've provided, looks like you can hit this error just with electron-forge package instead of electron-forge make — this would help limit the issue scope.

Are you using Git Bash somewhere else along the process (e.g. to run create-electron-app or to create the tmp directory) or are you just trying to make/package the app with it?

I figured it out (definitely this time). I think there are permission issues within the Documents folder or something on my setup - when I cloned the repo a level up ("~" in Git Bash), suddenly I was able to make and package just fine. Sorry about that!

@erikian erikian added question and removed blocked/needs-repro Issues unable to be reproduced by maintainers labels Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants