Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🛠 Repo: Unable to install on ARM Mac (node-pre-gyp and gyp failures) #5059

Closed
5 tasks done
JoshuaKGoldberg opened this issue Dec 28, 2023 · 1 comment · Fixed by #5069 or #5175
Closed
5 tasks done

🛠 Repo: Unable to install on ARM Mac (node-pre-gyp and gyp failures) #5059

JoshuaKGoldberg opened this issue Dec 28, 2023 · 1 comment · Fixed by #5069 or #5175
Assignees
Labels
area: repository tooling concerning ease of contribution status: accepting prs Mocha can use your help with this one! type: bug a defect, confirmed by a maintainer

Comments

@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Dec 28, 2023

Tooling Suggestion Checklist

Overview

Running npm i on my fancy schmancy M2 Macbook Air and ignoring npm WARN deprecated lines:

josh ~/repos/mocha $ npm i
npm ERR! code 1
npm ERR! path /Users/josh/repos/mocha/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build --update-binary
npm ERR! SOLINK_MODULE(target) Release/canvas-postbuild.node
npm ERR!   CXX(target) Release/obj.target/canvas/src/backend/Backend.o
npm ERR! Failed to execute '/Users/josh/.nvm/versions/node/v21.5.0/bin/node /Users/josh/.nvm/versions/node/v21.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --update-binary --module=/Users/josh/repos/mocha/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/josh/repos/mocha/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v120' (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@21.5.0 | darwin | arm64
npm ERR! (node:78281) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v120-darwin-unknown-arm64.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v120-darwin-unknown-arm64.tar.gz 
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for canvas@2.11.2 and node@21.5.0 (node-v120 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/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v120-darwin-unknown-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@21.5.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@10.0.1
npm ERR! gyp info using node@21.5.0 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.11.6 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 '/Users/josh/.nvm/versions/node/v21.5.0/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/josh/repos/mocha/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/josh/.nvm/versions/node/v21.5.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/josh/Library/Caches/node-gyp/21.5.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/josh/Library/Caches/node-gyp/21.5.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/josh/.nvm/versions/node/v21.5.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/josh/Library/Caches/node-gyp/21.5.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/josh/repos/mocha/node_modules/canvas',
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@21.5.0 | 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/backend/Backend.cc:1:
npm ERR! In file included from ../src/backend/Backend.h:6:
npm ERR! In file included from ../../nan/nan.h:60:
npm ERR! In file included from /Users/josh/Library/Caches/node-gyp/21.5.0/include/node/node.h:73:
npm ERR! In file included from /Users/josh/Library/Caches/node-gyp/21.5.0/include/node/v8.h:24:
npm ERR! In file included from /Users/josh/Library/Caches/node-gyp/21.5.0/include/node/v8-array-buffer.h:12:
npm ERR! /Users/josh/Library/Caches/node-gyp/21.5.0/include/node/v8-local-handle.h:253:5: error: static assertion failed due to requirement 'std::is_base_of<v8::Value, v8::Data>::value': type check
npm ERR!     static_assert(std::is_base_of<T, S>::value, "type check");
npm ERR!     ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! ../../nan/nan_callbacks_12_inl.h:175:20: note: in instantiation of function template specialization 'v8::Local<v8::Value>::Local<v8::Data>' requested here
npm ERR!       cbinfo(info, obj->GetInternalField(kDataIndex));
npm ERR!                    ^
npm ERR! In file included from ../src/backend/Backend.cc:1:
npm ERR! ../src/backend/Backend.h:60:14: warning: private field 'backend' is not used [-Wunused-private-field]
npm ERR!     Backend* backend;
npm ERR!              ^
npm ERR! 1 warning and 1 error generated.
npm ERR! make: *** [Release/obj.target/canvas/src/backend/Backend.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/josh/.nvm/versions/node/v21.5.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
npm ERR! gyp ERR! System Darwin 23.1.0
npm ERR! gyp ERR! command "/Users/josh/.nvm/versions/node/v21.5.0/bin/node" "/Users/josh/.nvm/versions/node/v21.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--update-binary" "--module=/Users/josh/repos/mocha/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/Users/josh/repos/mocha/node_modules/canvas/build/Release" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v120"
npm ERR! gyp ERR! cwd /Users/josh/repos/mocha/node_modules/canvas
npm ERR! gyp ERR! node -v v21.5.0
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/josh/.nvm/versions/node/v21.5.0/bin/node /Users/josh/.nvm/versions/node/v21.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --update-binary --module=/Users/josh/repos/mocha/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/josh/repos/mocha/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v120' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/josh/repos/mocha/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:519: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 23.1.0
npm ERR! node-pre-gyp ERR! command "/Users/josh/.nvm/versions/node/v21.5.0/bin/node" "/Users/josh/repos/mocha/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
npm ERR! node-pre-gyp ERR! cwd /Users/josh/repos/mocha/node_modules/canvas
npm ERR! node-pre-gyp ERR! node -v v21.5.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.10
npm ERR! node-pre-gyp ERR! not ok

This is from Mocha's dev tooling being set up back when it was common for packages such as gyp/node-gyp/node-pre-gyp to run C++ builds in npm installs.

We should update/switch packages so that code contributors & maintainers no longer need to have the right C++ compiler and/or Python version installed.

Additional Info

For now, a workaround is:

npm install --ignore-scripts
@JoshuaKGoldberg JoshuaKGoldberg added type: bug a defect, confirmed by a maintainer status: accepting prs Mocha can use your help with this one! area: repository tooling concerning ease of contribution labels Dec 28, 2023
@JoshuaKGoldberg JoshuaKGoldberg self-assigned this Dec 28, 2023
@JoshuaKGoldberg JoshuaKGoldberg moved this from Up Next to In Progress in Maintenance Reboot Dec 28, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in Maintenance Reboot Jan 8, 2024
@JoshuaKGoldberg
Copy link
Member Author

Re-opening as #5069 was reverted by #5095.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: repository tooling concerning ease of contribution status: accepting prs Mocha can use your help with this one! type: bug a defect, confirmed by a maintainer
Projects
1 participant