electron / forge

:electron: A complete tool for building and publishing Electron applications
https://electronforge.io
MIT License
6.52k stars 522 forks source link

Windows-only ASAR issue "links out of the package" #3222

Open busterbogheart opened 1 year ago

busterbogheart commented 1 year ago

Pre-flight checklist

Electron Forge version

6.1.1

Electron version

24.1.1

Operating system

Windows Server 2019 Datacenter

Last known working Electron Forge version

No response

Expected behavior

Due to long file name errors when build on Windows ("The fully qualified file name must be less than 260 characters...") we have enabled ASAR for our build. But one of our dependencies is npm linked which seems to cause the issue noted here. This is the lib-core module in the console output.

However: unlinking the lib-core module, clearing node_modules, and npm iing the module normally (without linking) gives the same result.

Expected behavior would be that the Windows VM build completes successfully just as the MacOS one does.

Actual behavior

Running npm run make errors out with the console output pasted below.

Steps to reproduce

Seemingly:

Additional information

package.json

    ...
    "make": "electron-forge make",
    ...

Output:

electron-packager Validation complete +1ms
electron-packager Running asar with the options {"unpack":"**/app/project-front-end/utils/native/**/*"} +26s
[FAILED] C:\Users\userx~1\AppData\Local\Temp\electron-packager\win32-x64\myprojectv33-0.4.0+190 BETA-qa-win32-x64-laexed\resources\app\node_modules\@acmedev\lib-core: file "..\..\..\..\..\..\..\..\..\xxx\Desktop\acmeLLC\lib-core" links out of the package
[FAILED] C:\Users\userx~1\AppData\Local\Temp\electron-packager\win32-x64\myprojectv33-0.4.0+190 BETA-qa-win32-x64-laexed\resources\app\node_modules\@acmedev\lib-core: file "..\..\..\..\..\..\..\..\..\xxx\Desktop\acmeLLC\lib-core" links out of the package
[FAILED] C:\Users\userx~1\AppData\Local\Temp\electron-packager\win32-x64\myprojectv33-0.4.0+190 BETA-qa-win32-x64-laexed\resources\app\node_modules\@acmedev\lib-core: file "..\..\..\..\..\..\..\..\..\xxx\Desktop\acmeLLC\lib-core" links out of the package
[FAILED] C:\Users\userx~1\AppData\Local\Temp\electron-packager\win32-x64\myprojectv33-0.4.0+190 BETA-qa-win32-x64-laexed\resources\app\node_modules\@acmedev\lib-core: file "..\..\..\..\..\..\..\..\..\xxx\Desktop\acmeLLC\lib-core" links out of the package

An unhandled rejection has occurred inside Forge:
Error: C:\Users\userx~1\AppData\Local\Temp\electron-packager\win32-x64\myprojectv33-0.4.0+190 BETA-qa-win32-x64-laexed\resources\app\node_modules\@acmedev\lib-core: file "..\..\..\..\..\..\..\..\..\xxx\Desktop\acmeLLC\lib-core" links out of the package
at Filesystem.insertLink (C:\Users\xxx\Desktop\acmeLLC\project-electron\node_modules\@electron\asar\lib\filesystem.js:104:13)
    at handleFile (C:\Users\xxx\Desktop\acmeLLC\project-electron\node_modules\@electron\asar\lib\asar.js:132:20)
    at async next (C:\Users\xxx\Desktop\acmeLLC\project-electron\node_modules\@electron\asar\lib\asar.js:148:5)
    at async WindowsApp.asarApp (C:\Users\xxx\Desktop\acmeLLC\project-electron\node_modules\electron-packager\src\platform.js:224:5)
    at async WindowsApp.buildApp 
busterbogheart commented 1 year ago

Does anyone have a clue for this issue?

akanksha-atrey commented 9 months ago

Same error. Any update on this?

bbpalm commented 7 months ago

step 1 open file: node_modules/@electron/asar/lib/filesystem.js

step2 104 line

const link = path.relative(fs.realpathSync(this.src), path.join(parentPath, symlink))

Replace with

const link = path.relative(fs.realpathSync(this.src), fs.realpathSync(path.join(parentPath, symlink)))

step3 Install patch-package

npx patch-package @electron/asar

Done!!!

1isten commented 7 months ago

When will this be fixed?

neila-a commented 7 months ago

When ASAR runs on bash at Linux, it also issue "links out of the package".