node-libcurl
node-libcurl copied to clipboard
Error invalid ELF header
ERROR
[Running] node -r ts-node/register "/media/dimaslanjaka/DATA/Repositories/gh-pages/src/gulp/tasks/fix-external-image.ts"
Error: /media/dimaslanjaka/DATA/Repositories/gh-pages/node_modules/node-libcurl/lib/binding/node_libcurl.node: invalid ELF header
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1183:18)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/media/dimaslanjaka/DATA/Repositories/gh-pages/node_modules/node-libcurl/lib/Easy.ts:10:44)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Object.require.extensions.<computed> [as .js] (/media/dimaslanjaka/DATA/Repositories/gh-pages/node_modules/ts-node/src/index.ts:1445:43)
at Module.load (node:internal/modules/cjs/loader:981:32) {
code: 'ERR_DLOPEN_FAILED'
}
[Done] exited with code=1 in 2.761 seconds
CODES TO REPRODUCE
import { curly } from 'node-libcurl';
const src = 'https://aws1.discourse-cdn.com/meteor/optimized/2X/e/ef0ba7cbf2b6749fe0220f6ed973027c4c61b251_2_690x362.png';
curly
.get(src, {
FOLLOWLOCATION: true,
REFERER: 'https://www.google.com',
})
.then((res) => {
const data = res.data;
const headers = res.headers;
const statusCode = res.statusCode;
if (statusCode === 200) {
const contentType = headers[0]['content-type'];
if (contentType.startsWith('image/')) {
console.log('success');
}
}
});
VERSIONS
"node-libcurl": "^2.3.4"
os: linux 5.13.0-39-generic Zorin OS 16.1
node: 16.13.0
v8: 9.4.146.19-node.13
uv: 1.42.0
zlib: 1.2.11
brotli: 1.0.9
ares: 1.17.2
modules: 93
nghttp2: 1.45.1
napi: 8
llhttp: 6.0.4
openssl: 1.1.1l+quic
cldr: 39.0
icu: 69.1
tz: 2021a
unicode: 13.0
ngtcp2: 0.1.0-DEV
nghttp3: 0.1.0-DEV
@JCMais @dimaslanjaka
lib/binding/node_libcurl.node: invalid ELF header
There are many projects on Github having same error.
Probably node-libcurl is not for Linux???
- https://github.com/veliovgroup/Meteor-Files/issues/781#issuecomment-759260179
- https://github.com/meteor/meteor/issues/11286#issue-786429724
- I can see same error while running this code on Linux but fine on Windows
To keep the maintainability of this project, I am closing old tickets (sorry if your ticket was kept open for so long without feedback).
If the issue continues with the latest version of node-libcurl, please feel free to create a new ticket.