forge icon indicating copy to clipboard operation
forge copied to clipboard

ENAMETOOLONG due to recursive copy

Open xiazhvera opened this issue 1 year ago • 3 comments

Pre-flight checklist

  • [X] I have read the contribution documentation for this project.
  • [X] I agree to follow the code of conduct 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.1.1

Electron version

v19.1.9

Operating system

macOS 13.4

Last known working Electron Forge version

No response

Expected behavior

Running electron-forge and package the sample with no error.

Actual behavior

Console Output:

> electron-forge make

✔ Checking your system
✔ Loading configuration
✔ Resolving make targets
  › Making for the following targets: zip
❯ Running package command
  ✔ Preparing to package application
  ✔ Running packaging hooks
    ✔ Running generateAssets hook
    ✔ Running prePackage hook
  ❯ Packaging application
    › Determining targets...
    ❯ Packaging for arm64 on darwin
      ✔ Copying files
      ⠋ Preparing native dependencies
      ◼ Finalizing package
  ◼ Running postPackage hook
◼ Running preMake hook
◼ Making distributables
◼ Running postMake hook

An unhandled rejection has occurred inside Forge:
Error: ENAMETOOLONG: name too long, scandir '/var/folders/5t/c51w9v_d5jn5_z5vvt0x2j_80000gr/T/
electron-packager/darwin-arm64/electron_sample-darwin-arm64-jlmkEx/Electron.app
/Contents/Resources/app/node_modules/<my-local-library>
/Contents/Resources/app/node_modules/<my-local-library>
/Contents/Resources/app/node_modules/<my-local-library>
/Contents/Resources/app/node_modules/<my-local-library>
/Contents/Resources/app/node_modules/<my-local-library>
/Contents/Resources/app/node_modules/<my-local-library>
/Contents/Resources/app/node_modules/<my-local-library>
/Contents/Resources/app/node_modules/<my-local-library>
/Contents/Resources/app/node_modules/<my-local-library>
/Contents/Resources/app/node_modules/<my-local-library>
/Contents/Resources/app/node_modules/<my-local-library>
/Contents/Resources/app/node_modules/<my-local-library>
/Contents/Resources/app/node_modules/<my-local-library>
/Contents/Resources/app/electron_sample-darwin-arm64/electron_sample.app
/Contents/Frameworks/electron_sample Helper (Plugin).app/Contents'

Steps to reproduce

The issue happens when I have a dependency to a local library using a relative path. Sample package.json


  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "./node_modules/.bin/tsc",
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make"
  },

// other options.....

  "dependencies": {
    "<my-local-library>": "file:../../../" (relative path to the library),
    },

Simply run npm run make could reproduce the issue.

Additional information

I did not see the issue if I use a version number instead of the relative path for the dependency. However, I would like to to build the application with my local distribution instead of the public version.

Besides, it seems that the issue does not occur when running electron-packager directly:

> npx electron-packager . --overwrite

I was able to package the sample without errors running the commands above.

Electron-packager had a similar issue and it has been fixed in 8.5.2. It could be related or similar: https://github.com/electron/electron-packager/issues/396

xiazhvera avatar Jun 09 '23 23:06 xiazhvera