Electron Forge: Error: ENOENT: no such file or directory
Asked Answered
M

3

6

im currently trying to build my Electron Application. For that, i am using Electron Forge. Everything works fine when i run npm start, but when i try to build it with npm run make i get the following error lines:

An unhandled rejection has occurred inside Forge:
[Error: ENOENT: no such file or directory, rename 'C:\Users\RENERE~1\AppData\Local\Temp\electron-packager\win32-x64\yt-downloader-win32-x64\electron.exe' -> 'C:\Users\RENERE~1\AppData\Local\Temp\electron-packager\win32-x64\yt-downloader-win32-x64\yt-downloader.exe'] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'rename',
  path: 'C:\\Users\\RENERE~1\\AppData\\Local\\Temp\\electron-packager\\win32-x64\\yt-downloader-win32-x64\\electron.exe',
  dest: 'C:\\Users\\RENERE~1\\AppData\\Local\\Temp\\electron-packager\\win32-x64\\yt-downloader-win32-x64\\yt-downloader.exe'
}

Here is the package.json file:

{
  "name": "yt-downloader",
  "productName": "yt-downloader",
  "version": "1.0.0",
  "description": "Download from Youtube",
  "main": "index.js",
  "scripts": {
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make",
    "publish": "electron-forge publish",
    "lint": "echo \"No linting configured\""
  },
  "keywords": [],
  "author": {
    "name": "Remling97",
    "email": "[email protected]"
  },
  "license": "MIT",
  "config": {
    "forge": {
      "packagerConfig": {},
      "makers": [
        {
          "name": "@electron-forge/maker-squirrel",
          "config": {
            "name": "yt_downloader"
          }
        },
        {
          "name": "@electron-forge/maker-zip",
          "platforms": [
            "darwin"
          ]
        },
        {
          "name": "@electron-forge/maker-deb",
          "config": {}
        },
        {
          "name": "@electron-forge/maker-rpm",
          "config": {}
        }
      ]
    }
  },
  "dependencies": {
    "electron-squirrel-startup": "^1.0.0",
    "ytdl-core": "^2.0.0",
    "ytpl": "^0.1.20"
  },
  "devDependencies": {
    "@electron-forge/cli": "6.0.0-beta.50",
    "@electron-forge/maker-deb": "6.0.0-beta.50",
    "@electron-forge/maker-rpm": "6.0.0-beta.50",
    "@electron-forge/maker-squirrel": "6.0.0-beta.50",
    "@electron-forge/maker-zip": "6.0.0-beta.50",
    "electron": "8.1.0"
  }
}

I couldnt really find an answer online to why this happens. Can anyone help me? I Already tryed reinstalling electron, electron-forge and nodejs nothing worked.

Mook answered 8/3, 2020 at 17:34 Comment(0)
M
4

If someone else has this error and cant find a solution:

  • the error occurs when you have a space in your Windows username
Mook answered 5/4, 2020 at 15:28 Comment(1)
No, i don't have and its happening with mePunkie
T
2

The bug has been reported to electron-packager on Github, and has been forwarded to the dependency which likely causes the bug. Although the issue was closed and supposedly fixed, I still encounter the issue and I don't think that renaming the Windows user is a satisfactory fix.

One possible workaround is pinning @electron-forge/maker-zip to version 6.0.0-beta.47 according to one user but it didn't work for me.

Thormora answered 6/5, 2020 at 14:17 Comment(0)
P
0

I found a solution, I added "electron-prebuilt-compile": "4.0.0" as a dev dependency and it worked. (it cannot be ^4.0.0 or a range like that, it must be one exact version like 4.0.0 or electron-forge will give the following error)

Electron forge was terminated:
You must depend on an EXACT version of "electron-prebuilt-compile" not a range (got "^4.0.0")
Parthinia answered 10/3, 2020 at 14:31 Comment(2)
hey, thanks for the answer, but i still get the same error :/Mook
Found the error ..., the error occurs when you have a space in your Windows username.Mook

© 2022 - 2024 — McMap. All rights reserved.