dfellis / h3-node

H3 binding to Node using N-API
MIT License
30 stars 5 forks source link

Npm install fails on MacOS M1 (arch=x64) #45

Closed pjarnfelt closed 2 years ago

pjarnfelt commented 2 years ago
npm ERR! code 127
npm ERR! path /Users/patrickjarnfelt/projects/SpiritWorld/spirit_world_server_cms/node_modules/h3-node
npm ERR! command failed
npm ERR! command sh -c bash -c "if node-gyp-build-test; then node-gyp-build; else npm run prebuild && node-gyp-build; fi"
npm ERR! > h3-node@3.7.1 prebuild
npm ERR! > bash .prebuild.sh
npm ERR! 
npm ERR! 
npm ERR! > h3-node@3.7.1 clean
npm ERR! > node-gyp clean && rm -rf h3
npm ERR! 
npm ERR! /usr/bin/make
npm ERR! /Users/patrickjarnfelt/projects/SpiritWorld/spirit_world_server_cms/node_modules/node-gyp-build/index.js:60
npm ERR!   throw new Error('No native build was found for ' + target + '\n    loaded from: ' + dir + '\n')
npm ERR!   ^
npm ERR! 
npm ERR! Error: No native build was found for platform=darwin arch=x64 runtime=node abi=93 uv=1 libc=glibc node=16.13.2
npm ERR!     loaded from: /Users/patrickjarnfelt/projects/SpiritWorld/spirit_world_server_cms/node_modules/h3-node
npm ERR! 
npm ERR!     at Function.load.path (/Users/patrickjarnfelt/projects/SpiritWorld/spirit_world_server_cms/node_modules/node-gyp-build/index.js:60:9)
npm ERR!     at load (/Users/patrickjarnfelt/projects/SpiritWorld/spirit_world_server_cms/node_modules/node-gyp-build/index.js:22:30)
npm ERR!     at Object.<anonymous> (/Users/patrickjarnfelt/projects/SpiritWorld/spirit_world_server_cms/node_modules/node-gyp-build/build-test.js:19:19)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1101:14)
npm ERR!     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:981:32)
npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
npm ERR!     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
npm ERR!     at node:internal/main/run_main_module:17:47
npm ERR! 
npm ERR! COMMON_CMAKE_ARGS=-DCMAKE_BUILD_TYPE=Release
npm ERR! + COMMON_CMAKE_ARGS=-DCMAKE_BUILD_TYPE=Release
npm ERR! 
npm ERR! npm run clean &&
npm ERR!   git clone https://github.com/uber/h3 &&
npm ERR!   cd h3 &&
npm ERR!   git checkout v3.7.2 &&
npm ERR!   if command -v make; then
npm ERR!     if [[ "${ARCH}" == "ia32" ]]; then
npm ERR!       cmake . ${COMMON_CMAKE_ARGS} -DCMAKE_C_FLAGS="-fPIC -m32";
npm ERR!     else
npm ERR!       cmake . ${COMMON_CMAKE_ARGS} -DCMAKE_C_FLAGS=-fPIC;
npm ERR!     fi
npm ERR!   else
npm ERR!     if [[ "${Platform}" == "x64" ]]; then
npm ERR!       cmake . ${COMMON_CMAKE_ARGS} -DCMAKE_VS_PLATFORM_NAME=${Platform} -G "Visual Studio 14 Win64";
npm ERR!     else
npm ERR!       cmake . ${COMMON_CMAKE_ARGS} -DCMAKE_VS_PLATFORM_NAME=${Platform};
npm ERR!     fi
npm ERR!   fi &&
npm ERR!   cmake --build . --target h3 --config Release &&
npm ERR!   cd .. &&
npm ERR!   prebuildify --target=node@`node --version | sed s/v//`
npm ERR! + npm run clean
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.4.1
npm ERR! gyp info using node@16.13.2 | darwin | x64
npm ERR! gyp info ok 
npm ERR! + git clone https://github.com/uber/h3
npm ERR! Cloning into 'h3'...
npm ERR! + cd h3
npm ERR! + git checkout v3.7.2
npm ERR! Note: switching to 'v3.7.2'.
npm ERR! 
npm ERR! You are in 'detached HEAD' state. You can look around, make experimental
npm ERR! changes and commit them, and you can discard any commits you make in this
npm ERR! state without impacting any branches by switching back to a branch.
npm ERR! 
npm ERR! If you want to create a new branch to retain commits you create, you may
npm ERR! do so (now or later) by using -c with the switch command. Example:
npm ERR! 
npm ERR!   git switch -c <new-branch-name>
npm ERR! 
npm ERR! Or undo this operation with:
npm ERR! 
npm ERR!   git switch -
npm ERR! 
npm ERR! Turn off this advice by setting config variable advice.detachedHead to false
npm ERR! 
npm ERR! HEAD is now at 26a6409 Backport fix potential segfault in kRing due to invalid digit (#498) (#500)
npm ERR! + command -v make
npm ERR! + [[ '' == \i\a\3\2 ]]
npm ERR! + cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS=-fPIC
npm ERR! .prebuild.sh: line 15: cmake: command not found
dfellis commented 2 years ago

Currently there are no pre-built binaries from any platform for this library. You need all of the build tools required to build the original H3 C library to install this correctly.

In this case, it tells you at the bottom of the error message that you need cmake to orchestrate the C library building, but you are probably missing a couple of others. Read this section of the H3 Readme and check which ones are in your $PATH.