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

node-gyp rebuild command failure on cpu-features

Open shahraship opened this issue 1 year ago • 5 comments

  • Node Version: 20.11.1, 10.8.2

  • Platform: Darwin uname-mbp-2.lan 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:16:51 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8103 arm64

  • Compiler: Apple clang version 15.0.0 (clang-1500.3.9.4) Target: arm64-apple-darwin23.5.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

  • Module: node-gyp rebuild

> electron-builder install-app-deps
  • electron-builder  version=24.13.3
  • rebuilding native dependencies  [email protected] platform=darwin arch=arm64
  ⨯ cannot execute  cause=exit status 1
                    errorOut=npm error code 1
    npm error path /Users/devuname/Developer/repo-name/node_modules/cpu-features
    npm error command failed
    npm error command sh -c node buildcheck.js > buildcheck.gypi && node-gyp rebuild
    npm error CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_aarch64_linux_or_android.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_aarch64_macos_or_iphone.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_aarch64_windows.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_arm_linux_or_android.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_mips_linux_or_android.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_ppc_linux.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_freebsd.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_linux_or_android.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_macos.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_windows.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/filesystem.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/stack_line_reader.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/string_view.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/hwcaps.o
    npm error   LIBTOOL-STATIC Release/cpu_features.a
    npm error   CXX(target) Release/obj.target/cpufeatures/src/binding.o
    npm error gyp info it worked if it ends with ok
    npm error gyp info using [email protected]
    npm error gyp info using [email protected] | darwin | arm64
    npm error gyp info find Python using Python version 3.11.6 found at "/opt/homebrew/opt/[email protected]/bin/python3.11"
    npm error gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.11
    npm error gyp info spawn args [
    npm error gyp info spawn args '/Users/devuname/Developer/repo-name/node_modules/node-gyp/gyp/gyp_main.py',
    npm error gyp info spawn args 'binding.gyp',
    npm error gyp info spawn args '-f',
    npm error gyp info spawn args 'make',
    npm error gyp info spawn args '-I',
    npm error gyp info spawn args '/Users/devuname/Developer/repo-name/node_modules/cpu-features/build/config.gypi',
    npm error gyp info spawn args '-I',
    npm error gyp info spawn args '/Users/devuname/Developer/repo-name/node_modules/node-gyp/addon.gypi',
    npm error gyp info spawn args '-I',
    npm error gyp info spawn args '/Users/devuname/.electron-gyp/28.3.3/include/node/common.gypi',
    npm error gyp info spawn args '-Dlibrary=shared_library',
    npm error gyp info spawn args '-Dvisibility=default',
    npm error gyp info spawn args '-Dnode_root_dir=/Users/devuname/.electron-gyp/28.3.3',
    npm error gyp info spawn args '-Dnode_gyp_dir=/Users/devuname/Developer/repo-name/node_modules/node-gyp',
    npm error gyp info spawn args '-Dnode_lib_file=/Users/devuname/.electron-gyp/28.3.3/<(target_arch)/node.lib',
    npm error gyp info spawn args '-Dmodule_root_dir=/Users/devuname/Developer/repo-name/node_modules/cpu-features',
    npm error gyp info spawn args '-Dnode_engine=v8',
    npm error gyp info spawn args '--depth=.',
    npm error gyp info spawn args '--no-parallel',
    npm error gyp info spawn args '--generator-output',
    npm error gyp info spawn args 'build',
    npm error gyp info spawn args '-Goutput_dir=.'
    npm error gyp info spawn args ]
    npm error gyp info spawn make
    npm error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
    npm error In file included from ../src/binding.cc:3:
    npm error ../../nan/nan.h:688:39: warning: 'IdleNotificationDeadline' is deprecated: Use MemoryPressureNotification() to influence the GC schedule. [-Wdeprecated-declarations]
    npm error     return v8::Isolate::GetCurrent()->IdleNotificationDeadline(
    npm error                                       ^
    npm error /Users/devuname/.electron-gyp/28.3.3/include/node/v8-isolate.h:1343:3: note: 'IdleNotificationDeadline' has been explicitly marked deprecated here
    npm error   V8_DEPRECATE_SOON(
    npm error   ^
    npm error /Users/devuname/.electron-gyp/28.3.3/include/node/v8config.h:561:41: note: expanded from macro 'V8_DEPRECATE_SOON'
    npm error #   define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
    npm error                                         ^
    npm error In file included from ../src/binding.cc:3:
    npm error ../../nan/nan.h:2548:8: error: no matching member function for call to 'SetAccessor'
    npm error   tpl->SetAccessor(
    npm error   ~~~~~^~~~~~~~~~~
    npm error /Users/devuname/.electron-gyp/28.3.3/include/node/v8-template.h:816:8: note: candidate function not viable: no known conversion from 'v8::PropertyAttribute' to 'AccessControl' for 5th argument
    npm error   void SetAccessor(
    npm error        ^
    npm error /Users/devuname/.electron-gyp/28.3.3/include/node/v8-template.h:809:8: note: candidate function not viable: no known conversion from 'imp::NativeGetter' (aka 'void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &)') to 'AccessorGetterCallback' (aka 'void (*)(Local<String>, const PropertyCallbackInfo<Value> &)') for 2nd argument
    npm error   void SetAccessor(
    npm error        ^
    npm error In file included from ../src/binding.cc:3:
    npm error ../../nan/nan.h:2596:8: error: no matching member function for call to 'SetAccessor'
    npm error   tpl->SetAccessor(
    npm error   ~~~~~^~~~~~~~~~~
    npm error /Users/devuname/.electron-gyp/28.3.3/include/node/v8-template.h:816:8: note: candidate function not viable: no known conversion from 'v8::PropertyAttribute' to 'AccessControl' for 5th argument
    npm error   void SetAccessor(
    npm error        ^
    npm error /Users/devuname/.electron-gyp/28.3.3/include/node/v8-template.h:809:8: note: candidate function not viable: no known conversion from 'imp::NativeGetter' (aka 'void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &)') to 'AccessorGetterCallback' (aka 'void (*)(Local<String>, const PropertyCallbackInfo<Value> &)') for 2nd argument
    npm error   void SetAccessor(
    npm error        ^
    npm error 1 warning and 2 errors generated.
    npm error make: *** [Release/obj.target/cpufeatures/src/binding.o] Error 1
    npm error gyp ERR! build error 
    npm error gyp ERR! stack Error: `make` failed with exit code: 2
    npm error gyp ERR! stack at ChildProcess.<anonymous> (/Users/devuname/Developer/repo-name/node_modules/node-gyp/lib/build.js:209:23)
    npm error gyp ERR! System Darwin 23.5.0
    npm error gyp ERR! command "/Users/devuname/.nvm/versions/node/v20.11.1/bin/node" "/Users/devuname/Developer/repo-name/node_modules/.bin/node-gyp" "rebuild"
    npm error gyp ERR! cwd /Users/devuname/Developer/repo-name/node_modules/cpu-features
    npm error gyp ERR! node -v v20.11.1
    npm error gyp ERR! node-gyp -v v10.1.0
    npm error gyp ERR! not ok
    npm error A complete log of this run can be found in: /Users/devuname/.npm/_logs/2024-08-06T16_16_44_793Z-debug-0.log
    
                    command=/Users/devuname/.nvm/versions/node/v20.11.1/bin/node /Users/devuname/.nvm/versions/node/v20.11.1/lib/node_modules/npm/bin/npm-cli.js rebuild [email protected]
                    workingDir=
npm error code 1
npm error path /Users/devuname/Developer/repo-name
npm error command failed
npm error command sh -c electron-builder install-app-deps
npm error A complete log of this run can be found in: /Users/devuname/.npm/_logs/2024-08-06T16_16_02_575Z-debug-0.log

Upgraded the node-gyp version to 10.2.0 as well and had similar error

> electron-builder install-app-deps

  • electron-builder  version=24.13.3
  • rebuilding native dependencies  [email protected] platform=darwin arch=arm64
  ⨯ cannot execute  cause=exit status 1
                    errorOut=npm error code 1
    npm error path /Users/devuname/Developer/repo-name/node_modules/cpu-features
    npm error command failed
    npm error command sh -c node buildcheck.js > buildcheck.gypi && node-gyp rebuild
    npm error CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_aarch64_linux_or_android.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_aarch64_macos_or_iphone.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_aarch64_windows.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_arm_linux_or_android.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_mips_linux_or_android.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_ppc_linux.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_freebsd.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_linux_or_android.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_macos.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_windows.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/filesystem.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/stack_line_reader.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/string_view.o
    npm error   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/hwcaps.o
    npm error   LIBTOOL-STATIC Release/cpu_features.a
    npm error   CXX(target) Release/obj.target/cpufeatures/src/binding.o
    npm error gyp info it worked if it ends with ok
    npm error gyp info using [email protected]
    npm error gyp info using [email protected] | darwin | arm64
    npm error gyp info find Python using Python version 3.11.6 found at "/opt/homebrew/opt/[email protected]/bin/python3.11"
    npm error gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.11
    npm error gyp info spawn args [
    npm error gyp info spawn args '/Users/devuname/Developer/repo-name/node_modules/node-gyp/gyp/gyp_main.py',
    npm error gyp info spawn args 'binding.gyp',
    npm error gyp info spawn args '-f',
    npm error gyp info spawn args 'make',
    npm error gyp info spawn args '-I',
    npm error gyp info spawn args '/Users/devuname/Developer/repo-name/node_modules/cpu-features/build/config.gypi',
    npm error gyp info spawn args '-I',
    npm error gyp info spawn args '/Users/devuname/Developer/repo-name/node_modules/node-gyp/addon.gypi',
    npm error gyp info spawn args '-I',
    npm error gyp info spawn args '/Users/devuname/.electron-gyp/28.3.3/include/node/common.gypi',
    npm error gyp info spawn args '-Dlibrary=shared_library',
    npm error gyp info spawn args '-Dvisibility=default',
    npm error gyp info spawn args '-Dnode_root_dir=/Users/devuname/.electron-gyp/28.3.3',
    npm error gyp info spawn args '-Dnode_gyp_dir=/Users/devuname/Developer/repo-name/node_modules/node-gyp',
    npm error gyp info spawn args '-Dnode_lib_file=/Users/devuname/.electron-gyp/28.3.3/<(target_arch)/node.lib',
    npm error gyp info spawn args '-Dmodule_root_dir=/Users/devuname/Developer/repo-name/node_modules/cpu-features',
    npm error gyp info spawn args '-Dnode_engine=v8',
    npm error gyp info spawn args '--depth=.',
    npm error gyp info spawn args '--no-parallel',
    npm error gyp info spawn args '--generator-output',
    npm error gyp info spawn args 'build',
    npm error gyp info spawn args '-Goutput_dir=.'
    npm error gyp info spawn args ]
    npm error gyp info spawn make
    npm error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
    npm error In file included from ../src/binding.cc:3:
    npm error ../../nan/nan.h:688:39: warning: 'IdleNotificationDeadline' is deprecated: Use MemoryPressureNotification() to influence the GC schedule. [-Wdeprecated-declarations]
    npm error     return v8::Isolate::GetCurrent()->IdleNotificationDeadline(
    npm error                                       ^
    npm error /Users/devuname/.electron-gyp/28.3.3/include/node/v8-isolate.h:1343:3: note: 'IdleNotificationDeadline' has been explicitly marked deprecated here
    npm error   V8_DEPRECATE_SOON(
    npm error   ^
    npm error /Users/devuname/.electron-gyp/28.3.3/include/node/v8config.h:561:41: note: expanded from macro 'V8_DEPRECATE_SOON'
    npm error #   define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
    npm error                                         ^
    npm error In file included from ../src/binding.cc:3:
    npm error ../../nan/nan.h:2548:8: error: no matching member function for call to 'SetAccessor'
    npm error   tpl->SetAccessor(
    npm error   ~~~~~^~~~~~~~~~~
    npm error /Users/devuname/.electron-gyp/28.3.3/include/node/v8-template.h:816:8: note: candidate function not viable: no known conversion from 'v8::PropertyAttribute' to 'AccessControl' for 5th argument
    npm error   void SetAccessor(
    npm error        ^
    npm error /Users/devuname/.electron-gyp/28.3.3/include/node/v8-template.h:809:8: note: candidate function not viable: no known conversion from 'imp::NativeGetter' (aka 'void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &)') to 'AccessorGetterCallback' (aka 'void (*)(Local<String>, const PropertyCallbackInfo<Value> &)') for 2nd argument
    npm error   void SetAccessor(
    npm error        ^
    npm error In file included from ../src/binding.cc:3:
    npm error ../../nan/nan.h:2596:8: error: no matching member function for call to 'SetAccessor'
    npm error   tpl->SetAccessor(
    npm error   ~~~~~^~~~~~~~~~~
    npm error /Users/devuname/.electron-gyp/28.3.3/include/node/v8-template.h:816:8: note: candidate function not viable: no known conversion from 'v8::PropertyAttribute' to 'AccessControl' for 5th argument
    npm error   void SetAccessor(
    npm error        ^
    npm error /Users/devuname/.electron-gyp/28.3.3/include/node/v8-template.h:809:8: note: candidate function not viable: no known conversion from 'imp::NativeGetter' (aka 'void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &)') to 'AccessorGetterCallback' (aka 'void (*)(Local<String>, const PropertyCallbackInfo<Value> &)') for 2nd argument
    npm error   void SetAccessor(
    npm error        ^
    npm error 1 warning and 2 errors generated.
    npm error make: *** [Release/obj.target/cpufeatures/src/binding.o] Error 1
    npm error gyp ERR! build error 
    npm error gyp ERR! stack Error: `make` failed with exit code: 2
    npm error gyp ERR! stack at ChildProcess.<anonymous> (/Users/devuname/Developer/repo-name/node_modules/node-gyp/lib/build.js:216:23)
    npm error gyp ERR! System Darwin 23.5.0
    npm error gyp ERR! command "/Users/devuname/.nvm/versions/node/v20.11.1/bin/node" "/Users/devuname/Developer/repo-name/node_modules/.bin/node-gyp" "rebuild"
    npm error gyp ERR! cwd /Users/devuname/Developer/repo-name/node_modules/cpu-features
    npm error gyp ERR! node -v v20.11.1
    npm error gyp ERR! node-gyp -v v10.2.0
    npm error gyp ERR! not ok
    npm error A complete log of this run can be found in: /Users/devuname/.npm/_logs/2024-08-07T17_17_27_276Z-debug-0.log
    
                    command=/Users/devuname/.nvm/versions/node/v20.11.1/bin/node /Users/devuname/.nvm/versions/node/v20.11.1/lib/node_modules/npm/bin/npm-cli.js rebuild [email protected]
                    workingDir=
npm error code 1
npm error path /Users/devuname/Developer/repo-name
npm error command failed
npm error command sh -c electron-builder install-app-deps
npm error A complete log of this run can be found in: /Users/devuname/.npm/_logs/2024-08-07T17_17_22_648Z-debug-0.log

shahraship avatar Aug 07 '24 17:08 shahraship

  • nodejs/nan#936
  • nodejs/nan#953

Are you using a current nan?

  • https://github.com/nodejs/nan/tags
  • https://www.npmjs.com/package/nan

cclauss avatar Aug 07 '24 17:08 cclauss

I had this same error while using the latest version of nan and electron v28, possible fix here: https://github.com/nodejs/nan/pull/982 (specific to Electron tho)

JCMais avatar Dec 10 '24 14:12 JCMais

I did face a similar issue with node v20.18.1 on my macOS machine. The build error thrown are giant.

Here's the last couple of lines:

npm error gyp ERR! build error 
npm error gyp ERR! stack Error: `make` failed with exit code: 2
npm error gyp ERR! stack at ChildProcess.<anonymous> (/Users/username/.nvm/versions/node/v20.18.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
npm error gyp ERR! System Darwin 23.6.0
npm error gyp ERR! command "/Users/username/.nvm/versions/node/v20.18.1/bin/node" "/Users/username/.nvm/versions/node/v20.18.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/Users/username/Documents/Projects/Git/tmp/my-cloud/lib/js/node_modules/grpc/src/node/extension_binary/node-v115-darwin-arm64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/Users/username/Documents/Projects/Git/tmp/my-cloud/lib/js/node_modules/grpc/src/node/extension_binary/node-v115-darwin-arm64-unknown" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v115"
npm error gyp ERR! cwd /Users/username/Documents/Projects/Git/tmp/my-cloud/lib/js/node_modules/grpc
npm error gyp ERR! node -v v20.18.1
npm error gyp ERR! node-gyp -v v10.1.0
npm error gyp ERR! not ok 
npm error node-pre-gyp ERR! build error 
npm error node-pre-gyp ERR! stack Error: Failed to execute '/Users/username/.nvm/versions/node/v20.18.1/bin/node /Users/username/.nvm/versions/node/v20.18.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/Users/username/Documents/Projects/Git/tmp/my-cloud/lib/js/node_modules/grpc/src/node/extension_binary/node-v115-darwin-arm64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/username/Documents/Projects/Git/tmp/my-cloud/lib/js/node_modules/grpc/src/node/extension_binary/node-v115-darwin-arm64-unknown --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v115' (1)
npm error node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/username/Documents/Projects/Git/tmp/my-cloud/lib/js/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm error node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:518:28)
npm error node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1104:16)
npm error node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:304:5)
npm error node-pre-gyp ERR! System Darwin 23.6.0
npm error node-pre-gyp ERR! command "/Users/username/.nvm/versions/node/v20.18.1/bin/node" "/Users/username/Documents/Projects/Git/tmp/my-cloud/lib/js/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
npm error node-pre-gyp ERR! cwd /Users/username/Documents/Projects/Git/tmp/my-cloud/lib/js/node_modules/grpc
npm error node-pre-gyp ERR! node -v v20.18.1
npm error node-pre-gyp ERR! node-pre-gyp -v v1.0.11
npm error node-pre-gyp ERR! not ok
npm error A complete log of this run can be found in: /Users/username/.npm/_logs/2024-12-12T13_38_34_182Z-debug-0.log

exetico avatar Dec 12 '24 13:12 exetico

@exetico Please retry with the new node-pre-gyp v2. If this fails with v2, please provide a full error log.

cclauss avatar Jan 27 '25 11:01 cclauss

A new version of nan was recently released. Please retry with that release. https://www.npmjs.com/package/nan

cclauss avatar Feb 21 '25 11:02 cclauss