JCMais / node-libcurl

libcurl bindings for Node.js
https://npmjs.org/package/node-libcurl
MIT License
666 stars 118 forks source link

npm install issues. #396

Closed yuvrajharod closed 12 months ago

yuvrajharod commented 1 year ago

I am getting an error whenever I am installing node libcurl and it's not gettings installed.

I am copy pasting the logs:


npm install node-libcurl
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
npm ERR! code 1
npm ERR! path /Users/user/folder/node_modules/node-libcurl
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build
npm ERR! CXX(target) Release/obj.target/node_libcurl/src/node_libcurl.o
npm ERR! Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/user/folder/node_modules/node-libcurl/lib/binding/node_libcurl.node --module_name=node_libcurl --module_path=/Users/user/folder/node_modules/node-libcurl/lib/binding --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v115' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.10
npm ERR! node-pre-gyp info using node@20.8.0 | darwin | arm64
npm ERR! node-pre-gyp info check checked for "/Users/user/folder/node_modules/node-libcurl/lib/binding/node_libcurl.node" (not found)
npm ERR! node-pre-gyp http GET https://github.com/JCMais/node-libcurl/releases/download/v3.0.0/node_libcurl-v3.0.0-node-v115-darwin-arm64-unknown.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/JCMais/node-libcurl/releases/download/v3.0.0/node_libcurl-v3.0.0-node-v115-darwin-arm64-unknown.tar.gz 
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for node-libcurl@3.0.0 and node@20.8.0 (node-v115 ABI, unknown) (falling back to source compile with node-gyp) 
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/JCMais/node-libcurl/releases/download/v3.0.0/node_libcurl-v3.0.0-node-v115-darwin-arm64-unknown.tar.gz 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.4.0
npm ERR! gyp info using node@20.8.0 | darwin | arm64
npm ERR! gyp info ok 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.4.0
npm ERR! gyp info using node@20.8.0 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.11.5 found at "/opt/homebrew/opt/python@3.11/bin/python3.11"
npm ERR! gyp info spawn /opt/homebrew/opt/python@3.11/bin/python3.11
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/user/folder/node_modules/node-libcurl/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/user/Library/Caches/node-gyp/20.8.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/user/Library/Caches/node-gyp/20.8.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/user/Library/Caches/node-gyp/20.8.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/user/folder/node_modules/node-libcurl',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libcurl.dylib (No such file or directory)
npm ERR! gyp info ok 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.4.0
npm ERR! gyp info using node@20.8.0 | darwin | arm64
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! clang: error: no such file or directory: '/usr/include'
npm ERR! make: *** [Release/obj.target/node_libcurl/src/node_libcurl.o] Error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
npm ERR! gyp ERR! System Darwin 22.4.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/user/folder/node_modules/node-libcurl/lib/binding/node_libcurl.node" "--module_name=node_libcurl" "--module_path=/Users/user/folder/node_modules/node-libcurl/lib/binding" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v115"
npm ERR! gyp ERR! cwd /Users/user/folder/node_modules/node-libcurl
npm ERR! gyp ERR! node -v v20.8.0
npm ERR! gyp ERR! node-gyp -v v9.4.0
npm ERR! gyp ERR! not ok 
npm ERR! node-pre-gyp ERR! build error 
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/user/folder/node_modules/node-libcurl/lib/binding/node_libcurl.node --module_name=node_libcurl --module_path=/Users/user/folder/node_modules/node-libcurl/lib/binding --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v115' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/user/folder/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1105:16)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
npm ERR! node-pre-gyp ERR! System Darwin 22.4.0
npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/user/folder/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /Users/user/folder/node_modules/node-libcurl
npm ERR! node-pre-gyp ERR! node -v v20.8.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.10
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in: /Users/user/.npm/_logs/2023-10-07T16_14_46_597Z-debug-0.log

Version:

OS: Mac OS Ventura 13.3.1 (a) Node.js Version: v20.8.0 curl: 7.87.0

mike-niemand commented 1 year ago

Same!

mike-niemand commented 1 year ago

Build it as per https://github.com/JCMais/node-libcurl#building-on-linux

nktnet1 commented 1 year ago

One workaround is to downgrade to node version 18 (e.g. by using nvm).

This way, you will be able to use the prebuilt binaries instead of having to build it from source, which is the cause of the error - see assets of v3.0.0:

yuvrajharod commented 1 year ago

thanks for your comments guys, after trying everything, as I had to make changes quick, i switched to Axios for now but I will use these if I ever have to get back to Nodelibcurl but I am sure others who are facing can try implementing this solution.

JCMais commented 12 months ago

thanks for the report!

this is the same as https://github.com/JCMais/node-libcurl/issues/399, I will close this one for now in favor of 399, ty!