node-gtk icon indicating copy to clipboard operation
node-gtk copied to clipboard

Install failed on Apple M1

Open sdjeong-zenaad opened this issue 1 year ago • 1 comments

node-pre-gyp has compile error

  • MaxBook Air / Apple M1 / 8GB ram / macOS Sonoma 14.5
  • xcode-select version 2408. xcode 15.4
  • nvm 0.39.7, node v18.20.1
  • Python 3.9.6

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

install log

❯ npm i node-gtk
npm WARN deprecated [email protected]: 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 [email protected]: This package is no longer supported.
npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated [email protected]: This package is no longer supported.
npm WARN deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm WARN deprecated [email protected]: This package is no longer supported.
npm WARN deprecated [email protected]: This package is no longer supported.
npm WARN deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm WARN deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm WARN deprecated [email protected]: This package is no longer supported.
npm WARN deprecated [email protected]: 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 [email protected]
npm ERR! node-pre-gyp info using [email protected] | 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 [email protected] and [email protected] (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 [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info find Python using Python version 3.12.3 found at "/opt/homebrew/opt/[email protected]/bin/python3.12"
npm ERR! gyp info spawn /opt/homebrew/opt/[email protected]/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 [email protected]
npm ERR! gyp info using [email protected] | 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?

sdjeong-zenaad avatar Jun 13 '24 03:06 sdjeong-zenaad

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.

romgrk avatar Jul 09 '24 01:07 romgrk

Reading again that log, you're missing the libffi dependency. Check the install section of the readme and make sure to have all dependencies.

romgrk avatar Jul 30 '25 20:07 romgrk