Request not being executed
See original GitHub issueOperating System:
macOS Mojave 10.4.5
Platform:
Electron 5.0.6
Curl:
curl 7.65.1 (x86_64-apple-darwin18.6.0) libcurl/7.65.1 OpenSSL/1.0.2s zlib/1.2.11 brotli/1.0.7 c-ares/1.15.0 libssh2/1.9.0 nghttp2/1.39.1 librtmp/2.3 Release-Date: 2019-06-05
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz Metalink NTLM NTLM_WB SPNEGO SSL TLS-SRP UnixSockets
Installed with the command:
npm_config_curl_static_build=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
I’m trying to make node-libcurl
work with no success. After reading the instructions to install the package for Electron (see above), and executing the following:
const { Curl } = require('node-libcurl');
const curl = new Curl();
console.log(curl);
curl.setOpt('URL', 'www.google.com');
curl.setOpt('FOLLOWLOCATION', true);
curl.on('end', function (statusCode, data, headers) {
console.info(statusCode);
console.info('---');
console.info(data.length);
console.info('---');
console.info(this.getInfo( 'TOTAL_TIME'));
this.close();
});
curl.on('error', curl.close.bind(curl));
curl.perform();
the end
callback is not being triggered, but if I put the same code under a basic Node app it works perfectly.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
To make it work with Electron, the library versions when executing
curl --version
andnode -p process.versions
must be the same, specificallybrotli
,OpenSSL
,nghttp2
andzlib
, as said in the documentation.curl --version
node -p process.versions
1. Update libraries
brew upgrade c-ares
brew upgrade nghttp2
brew install openssl@1.1
2. Install cURL from source
I tried to install a few cURL packages from brew, but none worked, since there was no way to specify all flags I needed. Building cURL from source solved the problem. This is the configure options I used, the important ones are those that set a path.
3. Reinstall node to link the new versions we just installed in step 1.
4. Install node-libcurl
Et voilà!
Hey, glad you got it working! If possible can you post the steps you took to identify the problem and how you solved it? It would be great for others having the same problem.