archway-network / cli

Develop WASM smart contracts with the Archway network developer CLI
https://docs.archway.io
Apache License 2.0
44 stars 21 forks source link

npm install @archwayhq/cli failing on mac osx m1 #312

Closed 4coffeeihadbreakfast closed 7 months ago

4coffeeihadbreakfast commented 7 months ago

i am having issues installing this package on Apple M1

npm install -g  @archwayhq/cli
npm ERR! code 1
npm ERR! path /usr/local/lib/node_modules/@archwayhq/cli/node_modules/@archwayhq/keyring-go
npm ERR! command failed
npm ERR! command sh -c node-gyp-build
npm ERR! CC(target) Release/obj.target/nothing/../../node-addon-api/nothing.o
npm ERR!   LIBTOOL-STATIC Release/nothing.a
npm ERR!   CXX(target) Release/obj.target/keyring-go/src/keyring.o
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.6.2 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.9.6 found at "/Library/Frameworks/Python.framework/Versions/3.9/bin/python3"
npm ERR! gyp info spawn /Library/Frameworks/Python.framework/Versions/3.9/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/usr/local/lib/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 '/usr/local/lib/node_modules/@archwayhq/cli/node_modules/@archwayhq/keyring-go/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/fourcoffee/Library/Caches/node-gyp/21.6.2/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/fourcoffee/Library/Caches/node-gyp/21.6.2',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/fourcoffee/Library/Caches/node-gyp/21.6.2/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/usr/local/lib/node_modules/@archwayhq/cli/node_modules/@archwayhq/keyring-go',
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 spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! warning: /Library/Developer/CommandLineTools/usr/bin/libtool: archive library: Release/nothing.a the table of contents is empty (no object file members in the library define global symbols)
npm ERR! ../src/keyring.cc:2:10: fatal error: '../out/keyring.h' file not found
npm ERR! #include "../out/keyring.h"
npm ERR!          ^~~~~~~~~~~~~~~~~~
npm ERR! 1 error generated.
npm ERR! make: *** [Release/obj.target/keyring-go/src/keyring.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> (/usr/local/lib/node_modules/node-gyp/lib/build.js:209:23)
npm ERR! gyp ERR! System Darwin 21.6.0
npm ERR! gyp ERR! command "/opt/homebrew/Cellar/node/21.6.2/bin/node" "/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /usr/local/lib/node_modules/@archwayhq/cli/node_modules/@archwayhq/keyring-go
npm ERR! gyp ERR! node -v v21.6.2
npm ERR! gyp ERR! node-gyp -v v10.0.1
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: /Users/fourcoffee/.npm/_logs/2024-02-24T07_54_39_609Z-debug-0.log
drewstaylor commented 7 months ago

Hey @4coffeeihadbreakfast

Looks similar to a problem I once had that turned out to be related to incompatible Go version (my Go installation was too old 😅 ). I was able to fix it by upgrading to1.21.6

Posting my output from when I had that error, so you can compare. Notably, same issue with ../out/keyring.h not being found.

$ npm install -g @archwayhq/cli
npm ERR! code 1
npm ERR! path /home/lsd/.nvm/versions/node/v16.20.0/lib/node_modules/@archwayhq/cli/node_modules/@archwayhq/keyring-go
npm ERR! command failed
npm ERR! command sh -c -- node-gyp-build
npm ERR! make: Entering directory '/home/lsd/.nvm/versions/node/v16.20.0/lib/node_modules/@archwayhq/cli/node_modules/@archwayhq/keyring-go/build'
npm ERR!   CC(target) Release/obj.target/nothing/../../node-addon-api/nothing.o
npm ERR!   AR(target) Release/obj.target/../../node-addon-api/nothing.a
npm ERR!   COPY Release/nothing.a
npm ERR!   CXX(target) Release/obj.target/keyring-go/src/keyring.o
npm ERR! keyring-go.target.mk:114: recipe for target 'Release/obj.target/keyring-go/src/keyring.o' failed
npm ERR! make: Leaving directory '/home/lsd/.nvm/versions/node/v16.20.0/lib/node_modules/@archwayhq/cli/node_modules/@archwayhq/keyring-go/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.1.0
npm ERR! gyp info using node@16.20.0 | linux | x64
npm ERR! gyp info find Python using Python version 3.6.9 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/home/lsd/.nvm/versions/node/v16.20.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   '/home/lsd/.nvm/versions/node/v16.20.0/lib/node_modules/@archwayhq/cli/node_modules/@archwayhq/keyring-go/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/lsd/.nvm/versions/node/v16.20.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/lsd/.cache/node-gyp/16.20.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=/home/lsd/.cache/node-gyp/16.20.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/home/lsd/.nvm/versions/node/v16.20.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/lsd/.cache/node-gyp/16.20.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/lsd/.nvm/versions/node/v16.20.0/lib/node_modules/@archwayhq/cli/node_modules/@archwayhq/keyring-go',
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 spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! ../src/keyring.cc:2:10: fatal error: ../out/keyring.h: No such file or directory
npm ERR!  #include "../out/keyring.h"
npm ERR!           ^~~~~~~~~~~~~~~~~~
npm ERR! compilation terminated.
npm ERR! make: *** [Release/obj.target/keyring-go/src/keyring.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.onExit (/home/lsd/.nvm/versions/node/v16.20.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:201:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Linux 5.10.16.3-microsoft-standard-WSL2
npm ERR! gyp ERR! command "/home/lsd/.nvm/versions/node/v16.20.0/bin/node" "/home/lsd/.nvm/versions/node/v16.20.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/lsd/.nvm/versions/node/v16.20.0/lib/node_modules/@archwayhq/cli/node_modules/@archwayhq/keyring-go
npm ERR! gyp ERR! node -v v16.20.0
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/lsd/.npm/_logs/2023-11-06T19_35_53_393Z-debug-0.log
4coffeeihadbreakfast commented 7 months ago

Hi @drewstaylor thanks for the response! unfortunately that did not seem to make a difference go version go1.22.0 darwin/arm64. can you think of anything else you may have done or installed?

4coffeeihadbreakfast commented 7 months ago

odd, i created a ubuntu docker image to try the install there and receive the same keyring error.

I was able to workaround this by installing a version prior to v2.0.0. e.g. @archwayhq/cli@1.6.2 and archwayd

4coffeeihadbreakfast commented 7 months ago

@aelesbao i think this issue is because the manifest on npm seems cached or not updated for some reason.

e.g. https://www.npmjs.com/package/@archwayhq/cli?activeTab=code

"@archwayhq/keyring-go": "^0.1.1",

the path #include "../out/keyring.h" was updated in v0.2.0-rc.2

aelesbao commented 6 months ago

@ 4coffeeihadbreakfast, can you please try installing the latest CLI version we just released? We had several issues with the keyring-go package on Windows. However, it's new for us to see the same in macOS with an M1 chip. Any help trying to debug this is be appreciated :)

aelesbao commented 6 months ago

Related to #310