Windows-only ASAR issue "links out of the package"
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
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:
- find a VM running Win Server 2019 (Datacenter edition)
- a new project with
npm init electron-app@latest testapp - clone a repo with a module into
.. npm link ../modulefromtestappproject- try
npm run makeand observe crash with "links out of the package" error
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
Does anyone have a clue for this issue?
Same error. Any update on this?
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!!!
When will this be fixed?
When ASAR runs on bash at Linux, it also issue "links out of the package".
I believe this is fixed in https://github.com/electron/asar/pull/308, which was released in @electron/asar v3.2.9. I believe you should be able to pull that version in your lockfile if it's not already there.
Is there confirmation on this fix or just assumed?
Hey @busterbogheart, I was just going through issues and closing ones that seemed like they would have been addressed by newer updates. If you have a repro with the latest version of @electron/asar, happy to open this one up again.