Search code examples
node.jselectronelectron-forge

electron forge make failing with errors (both squirrel and nuspec)


I'm trying to package an electron app into an exe to test if everythings working in a binary and then package it into an installer.

I made the app using create-electron-app and I'm using electron-forge.

The app seems to be running fine when I use npm start but whenever I run npm run make, both Squirrel builds and nuspec builds fail with errors

PS C:\Users\aryan\OneDrive\Documents\GitHub\yt-music-desk> npm run make

> youtube-music-desktop@1.0.0 make
> electron-forge make

✔ Checking your system
✔ Loading configuration
✔ Loading configuration
✔ Resolving make targets
  › Making for the following targets:
❯ Running package command
✔ Loading configuration
✔ Resolving make targets
  › Making for the following targets:
❯ Running package command
  ✔ Preparing to package application
  ❯ Running packaging hooks
    ✔ Running generateAssets hook
    ❯ Running prePackage hook
      ⠴ [plugin-vite] Building vite bundles
  ◼ Packaging application
g make targets
  › Making for the following targets:
❯ Running package command
g make targets
  › Making for the following targets:
❯ Running package command
  ✔ Preparing to package application
g make targets
  › Making for the following targets:
❯ Running package command
  ✔ Preparing to package application
  ✔ Running packaging hooks
    ✔ Running generateAssets hook
g make targets
  › Making for the following targets:
❯ Running package command
  ✔ Preparing to package application
g make targets
  › Making for the following targets:
g make targets
  › Making for the following targets:
❯ Running package command
  ✔ Preparing to package application
✔ Loading configuration
✔ Resolving make targets
  › Making for the following targets:
✔ Running package command
✔ Loading configuration
✔ Resolving make targets
  › Making for the following targets:
✔ Running package command
  ✔ Preparing to package application
  ✔ Running packaging hooks
    ✔ Running generateAssets hook
    ✔ Running prePackage hook
      ✔ [plugin-vite] Building vite bundles
  ✔ Packaging application
    ✔ Packaging for x64 on win32 [16s]
  ✔ Running postPackage hook
✔ Running preMake hook
❯ Making distributables
  ✖ Making a squirrel distributable for win32/x64
    › Failed with exit code: 1
    Output:
    Attempting to build package from 'youtube_music_desktop.nuspec'.
      The specified path, file name, or both are too long. The fully qualified file name must be less …  
◼ Running postMake hook

An unhandled rejection has occurred inside Forge:
Error: Failed with exit code: 1
Output:
Attempting to build package from 'youtube_music_desktop.nuspec'.
The specified path, file name, or both are too long. The fully qualified file name must be less than 260 
characters, and the directory name must be less than 248 characters.
at ChildProcess.<anonymous> (C:\Users\aryan\OneDrive\Documents\GitHub\yt-music-desk\node_modules\electron-winstaller\src\spawn-promise.ts:52:16)
    at ChildProcess.emit (node:events:515:28)
    at ChildProcess.emit (node:domain:488:12)
    at maybeClose (node:internal/child_process:1105:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:305:5)

Fixes that I've tried:

  1. Running npm run package first and then run npm run make.
  2. Increasing max path length in registry using Powershell.

None of the fixes seem to be working.

The squirrel build of the app got created(nuspec failed) when I first built it but after making some changes to the code, both of them seem to fail.


Solution

  • Unfortunately, I couldn't find a fix for this issue but I had to use electron-packager instead of electron-forge and it worked fine.