Failed to install node-libcurl for electron 5.0.10, both on mac and windows

344 Views Asked by At

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?

1

There are 1 best solutions below

3
jonathancardoso On

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