I can add the node-libcurl
to package.json
/yarn.lock
by typing yarn add node-libcurl
. But when going to the second phase electron-rebuild
, it failed all the time. I tried many node versions with nvm from 10.11.0
to 13.5.0
, all failed. I would doubt it is a electron-rebuild problem
, but not sure. How to make it work with electron. Can someone fatcat give me a clue?
Asked
Active
Viewed 310 times
1

W.Perrin
- 4,217
- 32
- 31
1 Answers
0
This happens because yarn add node-libcurl
is installing the prebuilt binary for the Node.js version you are using, and not for Electron.
To use node-libcurl
with electron the yarn command needs some extra environment variables, this is the command you should be running:
npm_config_build_from_source=true \
npm_config_runtime=electron \
npm_config_target=$(yarn --silent electron --version) \
npm_config_disturl=https://atom.io/download/atom-shell \
yarn add node-libcurl

jonathancardoso
- 11,737
- 7
- 53
- 72
-
`npm_config_runtime=electron npm_config_target=5.0.10 npm_config_disturl=https://atom.io/download/atom-shell yarn add node-libcurl`, I wanted to use the prebuild binary and tried this several times, it didn't work. I also tried to build from source with `npm_config_build_from_source=true`, it didn't work neither. – W.Perrin Jan 02 '20 at 12:46
-
I opened an issue for this with some detailed logs. Please check it. https://github.com/JCMais/node-libcurl/issues/206 – W.Perrin Jan 02 '20 at 13:32
-
May you please add an electron demo in the repo? I use the guidance of building from source for electron on mac, it installed successfully, but when imported from my project, it compiled failed. @JCM – W.Perrin Jan 06 '20 at 04:41