Remling
Remling

Reputation: 211

Electron Forge: Error: ENOENT: no such file or directory

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.

Upvotes: 6

Views: 9726

Answers (3)

Rémi Desmartin
Rémi Desmartin

Reputation: 123

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.

Upvotes: 2

Remling
Remling

Reputation: 211

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

  • the error occurs when you have a space in your Windows username

Upvotes: 4

Lazzy
Lazzy

Reputation: 58

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")

Upvotes: 0

Related Questions