Closed maphstr closed 1 year ago
I'm having something very similar with
/project-dir/git/angular-electron/dist/150.e37d8e7f4efc2bc5.js must be under /project-dir/git/angular-electron/app/
as well but it is for a different file. It does seem to be only with asarUnpack
as well.
My config is something like:
{
"asar": true,
"asarUnpack": ["filename.exe"],
"files": [
{
"from": "../../filename.exe"
}
]
}
I hacked this to work by tracing the error down to this line https://github.com/electron-userland/electron-builder/blob/28cb86bdcb6dd0b10e75a69ccd34ece6cca1d204/packages/app-builder-lib/src/asar/asarUtil.ts#L116
I think it might have to do with me having a two package.json structure or something, cause i saw that it tried to run this isUnpacked line on all my files in dist as well, and could not locate them.
Quick fix that seemed to work for me was to change that line with
if (file.includes('dist')) {
isUnpacked = false;
} else {
isUnpacked = dirNode.unpacked || (this.unpackPattern != null && this.unpackPattern(file, stat));
}
Not a good solution but perhaps it helps someone else.
That is bizarre behavior indeed. I see that both of your configs are relative and up the file tree. What happens if you add a to: "./"
to the from/filter object to force a FileSet?
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.
Same issue, when i set up asarUnpack value, and electron builder will check if all files are under the root dir of my project even if i move files into it in files option. But when not set up it, electron builder will not check that. Maybe there is a issue of execution sequence of files and asarUnpack options
Hello, i seem to have gone down the same road, did any find a resolution to this ?
Version node: v18.17.1 electron: 27.3.0 electron-builder: 24.9.1
electron-builder.json
"asarUnpack": ["**/node_modules/x/**/*",],
"files": [
"**/*",
"!**/*.ts",
"!*.map",
{
"from": "./../dist",
"filter": ["**/*"]
}
],
I hacked this to work by tracing the error down to this line
I think it might have to do with me having a two package.json structure or something, cause i saw that it tried to run this isUnpacked line on all my files in dist as well, and could not locate them.
Quick fix that seemed to work for me was to change that line with
if (file.includes('dist')) { ``` isUnpacked = false; } else { isUnpacked = dirNode.unpacked || (this.unpackPattern != null && this.unpackPattern(file, stat)); } ```
Not a good solution but perhaps it helps someone else.
Is still working for me. I included a step in npm install where i overwrite a separate copy of asarUtil over the official one.
@maphstr Cheers for the response and glad you were able to resolve the issue. I did see your comment and was intrigued, I started digging around with what you suggested but hit a dead end. Would be good to see how the npm i
step is configured.
I included a step in my publishing stage to move the dist folder to the correct directory before building, using cpx. I'm guessing this is a bug with electron-builder
as this was previously working when not specifying asarUnpack
.
Sure, it's been a while so I don't remember exactly but this at least is the line in my package.json. I've put the modified asarUtil.js in my src/ folder.
"scripts": {
"postinstall": "electron-builder install-app-deps && cp src/asarUtil.js node_modules/app-builder-lib/out/asar/asarUtil.js",
...
Hi, i am trying to get asarUnpack to unpack a folder with scripts for me (bat, ps) that i need to be unpacked in order to run them on a windows client.
Ive located these in a folder 'scripts' and have tried every version of specifing this folder in asarUnpack i can think of. I am using angular and a 'two-package.json-structure' from this boilerplate. https://github.com/maximegris/angular-electron
electron-builder.json:
However, no matter how i specify "scripts" under asarUnpack, i get this error:
Ive tried
and every variation. Always the same error.Btw, "150.e37d8e7f4efc2bc5.js" which the error mentions is one of the built js files that are in dist, and are in the asar-archive during successfull builds (when i remove the asarUnpack line)
Anyone have any clue what is going wrong here?
Mads