romgrk / node-gtk

GTK+ bindings for NodeJS (via GObject introspection)
MIT License
494 stars 42 forks source link

Install failed on Apple M1 #364

Open sdjeong-zenaad opened 3 months ago

sdjeong-zenaad commented 3 months ago

node-pre-gyp has compile error

preinstalled brew install gobject-introspection gtk+3 cairo with git + node

install log

❯ npm i node-gtk
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated npmlog@5.0.1: This package is no longer supported.
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
npm WARN deprecated npmlog@6.0.2: This package is no longer supported.
npm WARN deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm WARN deprecated are-we-there-yet@2.0.0: This package is no longer supported.
npm WARN deprecated are-we-there-yet@3.0.1: This package is no longer supported.
npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm WARN deprecated glob@8.1.0: Glob versions prior to v9 are no longer supported
npm WARN deprecated gauge@3.0.2: This package is no longer supported.
npm WARN deprecated gauge@4.0.4: This package is no longer supported.
npm ERR! code 1
npm ERR! path /Users/xxx/Documents/Works/gtktest/node_modules/node-gtk
npm ERR! command failed
npm ERR! command sh -c npx node-pre-gyp install --fallback-to-build
npm ERR! CXX(target) Release/obj.target/node_gtk/src/async_call_environment.o
npm ERR!   CXX(target) Release/obj.target/node_gtk/src/async_call_wrapper.o
npm ERR!   CXX(target) Release/obj.target/node_gtk/src/boxed.o
npm ERR! Failed to execute '/Users/xxx/.nvm/versions/node/v18.20.1/bin/node /Users/xxx/.nvm/versions/node/v18.20.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/xxx/Documents/Works/gtktest/node_modules/node-gtk/lib/binding/node-v108-darwin-arm64/node_gtk.node --module_name=node_gtk --module_path=/Users/xxx/Documents/Works/gtktest/node_modules/node-gtk/lib/binding/node-v108-darwin-arm64 --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (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.11
npm ERR! node-pre-gyp info using node@18.20.1 | darwin | arm64
npm ERR! node-pre-gyp info check checked for "/Users/xxx/Documents/Works/gtktest/node_modules/node-gtk/lib/binding/node-v108-darwin-arm64/node_gtk.node" (not found)
npm ERR! node-pre-gyp http GET https://node-gtk-1.s3.amazonaws.com/node_gtk/v0.14.0/node_gtk-node-v108-darwin-arm64.tar.gz
npm ERR! node-pre-gyp ERR! install response status 403 Forbidden on https://node-gtk-1.s3.amazonaws.com/node_gtk/v0.14.0/node_gtk-node-v108-darwin-arm64.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for node-gtk@0.14.0 and node@18.20.1 (node-v108 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error response status 403 Forbidden on https://node-gtk-1.s3.amazonaws.com/node_gtk/v0.14.0/node_gtk-node-v108-darwin-arm64.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@10.0.1
npm ERR! gyp info using node@18.20.1 | 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@10.0.1
npm ERR! gyp info using node@18.20.1 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.12.3 found at "/opt/homebrew/opt/python@3.12/bin/python3.12"
npm ERR! gyp info spawn /opt/homebrew/opt/python@3.12/bin/python3.12
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/Users/xxx/.nvm/versions/node/v18.20.1/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/xxx/Documents/Works/gtktest/node_modules/node-gtk/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/xxx/.nvm/versions/node/v18.20.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/xxx/Library/Caches/node-gyp/18.20.1/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/xxx/Library/Caches/node-gyp/18.20.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/xxx/.nvm/versions/node/v18.20.1/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/xxx/Library/Caches/node-gyp/18.20.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/xxx/Documents/Works/gtktest/node_modules/node-gtk',
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! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@10.0.1
npm ERR! gyp info using node@18.20.1 | darwin | arm64
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../src/boxed.cc:8:
npm ERR! In file included from ../src/function.h:7:
npm ERR! /opt/homebrew/Cellar/gobject-introspection/1.80.1/include/gobject-introspection-1.0/girffi.h:25:10: fatal error: 'ffi.h' file not found
npm ERR! #include <ffi.h>
npm ERR!          ^~~~~~~
npm ERR! 1 error generated.
npm ERR! make: *** [Release/obj.target/node_gtk/src/boxed.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.<anonymous> (/Users/xxx/.nvm/versions/node/v18.20.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
npm ERR! gyp ERR! System Darwin 23.5.0
npm ERR! gyp ERR! command "/Users/xxx/.nvm/versions/node/v18.20.1/bin/node" "/Users/xxx/.nvm/versions/node/v18.20.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/xxx/Documents/Works/gtktest/node_modules/node-gtk/lib/binding/node-v108-darwin-arm64/node_gtk.node" "--module_name=node_gtk" "--module_path=/Users/xxx/Documents/Works/gtktest/node_modules/node-gtk/lib/binding/node-v108-darwin-arm64" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v108"
npm ERR! gyp ERR! cwd /Users/xxx/Documents/Works/gtktest/node_modules/node-gtk
npm ERR! gyp ERR! node -v v18.20.1
npm ERR! gyp ERR! node-gyp -v v10.0.1
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 '/Users/xxx/.nvm/versions/node/v18.20.1/bin/node /Users/xxx/.nvm/versions/node/v18.20.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/xxx/Documents/Works/gtktest/node_modules/node-gtk/lib/binding/node-v108-darwin-arm64/node_gtk.node --module_name=node_gtk --module_path=/Users/xxx/Documents/Works/gtktest/node_modules/node-gtk/lib/binding/node-v108-darwin-arm64 --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/xxx/Documents/Works/gtktest/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:517:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1098:16)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:303:5)
npm ERR! node-pre-gyp ERR! System Darwin 23.5.0
npm ERR! node-pre-gyp ERR! command "/Users/xxx/.nvm/versions/node/v18.20.1/bin/node" "/Users/xxx/Documents/Works/gtktest/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /Users/xxx/Documents/Works/gtktest/node_modules/node-gtk
npm ERR! node-pre-gyp ERR! node -v v18.20.1
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.11
npm ERR! node-pre-gyp ERR! not ok

how to fix it?

romgrk commented 3 months ago

Not sure, never tried building on M1 and I don't have a macOS so I can't debug that. Looks like it's trying to download prebuilt binaries but there aren't available. It should fall back to building from source, not sure why it fails.