Version: latest
Target: all but here windows
Hello, yesterday I got an error. Nothing before and this happened right after just updated electron-builder.

This is the .exe after installing the application with the setup given by Travis on my s3 bucket.
I don't know how to fix this ... I've tried things like "buildDependenciesFromSource" "nodeGypRebuild" etc but nothing seems to work.
Thanks
Alright, this one took us a while here at Google to trace and debug and understand what's going on. Although the bug report is fairly scarce, @murgatroid99 and myself managed to extract enough information out of the screenshot to get us going. This was fun.
There's a shared amount of responsability in this problem between electron-builder and node-pre-gyp. The crux of the problem is this older bug report (and this one bug here is a duplicate of it): https://github.com/mapbox/node-pre-gyp/issues/383 - a good demonstration of what's going on has been done by somebody else, here: https://github.com/mark-buer/grpc-win-fail
If you read the demo properly, what's going on is that electron-builder is cross compiling from Linux to Windows using npm rebuild, but node-pre-gyp still uses the glibc string for the libc variable, resulting in an invalid module name, as seen in this screenshot: electron-v2.0-win32-x64-glibc. The proper module name would be electron-v2.0-win32-x64-unknown, again, as the screenshot says.
Now the reason I'm saying there's shared responsibility is that while https://github.com/mapbox/node-pre-gyp/issues/383 suggestion may be a valid way to solve this, electron-builder obviously knows about some portions of node-pre-gyp, as evidenced here: https://github.com/electron-userland/electron-builder/blob/d649815e62c44e60fed624077464711cb3cf5462/packages/electron-builder-lib/src/util/yarn.ts#L41
So a good way to solve these bugs would be for electron-builder to also add the --target_libc=unknown option when cross-compiling for Windows.
One might want to rename this bug to "electron-builder fails to pass the --target-libc option for node-pre-gyp", or something of that ilk.
I worked around this issue by explicitly setting target_libc for windows builds as follows:
npm_config_target_libc=unknown yarn electron-builder --config electron-builder.yaml --win
Thanks! Where should I put that with my Travis build ?
Looking at what I assume is your travis file, I deduce that you're currently packaging for linux and windows at the same time via the /bin/bash -c "yarn --link-duplicates --pure-lockfile && yarn release --linux --win" docker run command.
I'm guessing you might need/want to split that single yarn release --linux --win invocation into two separate invocations. You only need to apply the environment variable fix to the windows packaging process. Applying the fix to the linux packaging process may have unintended consequences.
Mhh okay I wanna see that but this is just the Travis file that I found in the documentation: https://www.electron.build/multi-platform-build (https://github.com/develar/onshape-desktop-shell/blob/master/.travis.yml)
So i'm not sure to know how to change this, but i'm gonna try
I tried: yarn release --linux && npm_config_target_libc=unknown yarn release --win
And this time :
Btw, I don't sure to understand this line (/project) ; https://github.com/develar/onshape-desktop-shell/blob/960dfdc2b4db2dbf5a32cac0872cbff8846fd624/.travis.yml#L36
Sorry, I've no idea what that error is about.
I can help with the docker question though...
-v ${PWD}:/project maps the current working directory outside of the docker instance to the directory /project inside of the docker instance. It's basically what enables the docker instance to "see" the source code.
Ok thanks i see. But I can’t get this working :/ ... you tell me to split the Linux and Windows things but I tried many things and never work .. how you will do it in my Travis file ?
Guys, I feel this is getting a bit lost here - the primary problem here is a bug-coupling between node-pre-gyp and electron-builder. We should focus on getting the author's attention to it, instead of trying to workaround the problem temporarily.
Yeah you are right but I don’t know how to do while this is not fixed
So a good way to solve these bugs would be for electron-builder to also add the --target_libc=unknown option when cross-compiling for Windows
And why node pre gyp cannot do it if clearly stated that host is Linux, but target win? Ok, thanks for full details — this option will be specified. Fix will be in 1 day.
And yes — we don’t like node-pre-gyp and strongly recommend using prebuild instead. But you, as end users, are hostages when npm Module author still doesn’t use prebuild. That’s why electron-builder have to support node-pre-gyp :(
Thanks a lot, @develar for your work!
could you please do the same for darwin, as it is also not a glibc
Windows now ok:
2020-08-01 05:51:26 | node-pre-gyp info it worked if it ends with ok
2020-08-01 05:51:26 | node-pre-gyp verb cli [
2020-08-01 05:51:26 | node-pre-gyp verb cli '/usr/local/bin/node',
2020-08-01 05:51:26 | node-pre-gyp verb cli '/project/node_modules/node-libcurl/node_modules/.bin/node-pre-gyp',
2020-08-01 05:51:26 | node-pre-gyp verb cli 'install',
2020-08-01 05:51:26 | node-pre-gyp verb cli '--fallback-to-build'
2020-08-01 05:51:26 | node-pre-gyp verb cli ]
2020-08-01 05:51:26 | node-pre-gyp info using [email protected]
2020-08-01 05:51:26 | node-pre-gyp info using [email protected] | linux | x64
2020-08-01 05:51:26 | node-pre-gyp verb command install []
2020-08-01 05:51:26 | node-pre-gyp WARN Using request for node-pre-gyp https download
2020-08-01 05:51:26 | node-pre-gyp http GET https://github.com/JCMais/node-libcurl/releases/download/v2.2.0/node_libcurl-v2.2.0-electron-v8.1-win32-x64-unknown.tar.gz
2020-08-01 05:51:26 | node-pre-gyp http 200 https://github.com/JCMais/node-libcurl/releases/download/v2.2.0/node_libcurl-v2.2.0-electron-v8.1-win32-x64-unknown.tar.gz
Darwin - not ok:
2020-08-01 05:53:38 | node-pre-gyp verb cli [
2020-08-01 05:53:38 | node-pre-gyp verb cli '/usr/local/bin/node',
2020-08-01 05:53:38 | node-pre-gyp verb cli '/project/node_modules/node-libcurl/node_modules/.bin/node-pre-gyp',
2020-08-01 05:53:38 | node-pre-gyp verb cli 'install',
2020-08-01 05:53:38 | node-pre-gyp verb cli '--fallback-to-build'
2020-08-01 05:53:38 | node-pre-gyp verb cli ]
2020-08-01 05:53:38 | node-pre-gyp info using [email protected]
2020-08-01 05:53:38 | node-pre-gyp info using [email protected] | linux | x64
2020-08-01 05:53:38 | node-pre-gyp verb command install []
2020-08-01 05:53:38 | node-pre-gyp WARN Using request for node-pre-gyp https download
2020-08-01 05:53:38 | node-pre-gyp http GET https://github.com/JCMais/node-libcurl/releases/download/v2.2.0/node_libcurl-v2.2.0-electron-v8.1-darwin-x64-glibc.tar.gz
2020-08-01 05:53:38 | node-pre-gyp http 404 https://github.com/JCMais/node-libcurl/releases/download/v2.2.0/node_libcurl-v2.2.0-electron-v8.1-darwin-x64-glibc.tar.gz
2020-08-01 05:53:38 | node-pre-gyp WARN Tried to download(404): https://github.com/JCMais/node-libcurl/releases/download/v2.2.0/node_libcurl-v2.2.0-electron-v8.1-darwin-x64-glibc.tar.gz
2020-08-01 05:53:38 | node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (electron-v8.1 ABI, glibc) (falling back to source compile with node-gyp)
2020-08-01 05:53:38 | node-pre-gyp http 404 status code downloading tarball https://github.com/JCMais/node-libcurl/releases/download/v2.2.0/node_libcurl-v2.2.0-electron-v8.1-darwin-x64-glibc.tar.gz
Most helpful comment
I worked around this issue by explicitly setting target_libc for windows builds as follows: