anyproto / anytype-ts

Official Anytype client for MacOS, Linux, and Windows
https://anytype.io
Other
4.49k stars 268 forks source link

local installation / setup error on macos #1031

Open uinstinct opened 1 week ago

uinstinct commented 1 week ago

Have you read a contributing guide?

Current Behavior

antype-ts fails during installation with the following error on macos silicon

it seems to be some problem with keytar

npm i

> anytype@0.43.9-alpha postinstall
> npx electron-builder install-app-deps

  • electron-builder  version=24.13.3
  • loaded configuration  file=package.json ("build" field)
  • rebuilding native dependencies  dependencies=keytar@7.9.0 platform=darwin arch=arm64
  ⨯ cannot execute  cause=exit status 1
                    errorOut=npm error code 1
    npm error path /Users/instinct/Desktop/anytype-ts/node_modules/keytar
    npm error command failed
    npm error command sh -c prebuild-install || npm run build
    npm error > keytar@7.9.0 build
    npm error > node-gyp rebuild
    npm error
    npm error   CXX(target) Release/obj.target/keytar/src/async.o
    npm error gyp info it worked if it ends with ok
    npm error gyp info using node-gyp@9.4.1
    npm error gyp info using node@20.5.1 | darwin | arm64
    npm error gyp info find Python using Python version 3.12.2 found at "/opt/miniconda3/bin/python3"
    npm error gyp info spawn /opt/miniconda3/bin/python3
    npm error gyp info spawn args [
    npm error gyp info spawn args   '/Users/instinct/Desktop/anytype-ts/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/instinct/Desktop/anytype-ts/node_modules/keytar/build/config.gypi',
    npm error gyp info spawn args   '-I',
    npm error gyp info spawn args   '/Users/instinct/Desktop/anytype-ts/node_modules/node-gyp/addon.gypi',
    npm error gyp info spawn args   '-I',
    npm error gyp info spawn args   '/Users/instinct/.electron-gyp/33.0.1/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/instinct/.electron-gyp/33.0.1',
    npm error gyp info spawn args   '-Dnode_gyp_dir=/Users/instinct/Desktop/anytype-ts/node_modules/node-gyp',
    npm error gyp info spawn args   '-Dnode_lib_file=/Users/instinct/.electron-gyp/33.0.1/<(target_arch)/node.lib',
    npm error gyp info spawn args   '-Dmodule_root_dir=/Users/instinct/Desktop/anytype-ts/node_modules/keytar',
    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 ../src/async.cc:1:10: fatal error: 'string' file not found
    npm error     1 | #include <string>
    npm error       |          ^~~~~~~~
    npm error 1 error generated.
    npm error make: *** [Release/obj.target/keytar/src/async.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.onExit (/Users/instinct/Desktop/anytype-ts/node_modules/node-gyp/lib/build.js:203:23)
    npm error gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
    npm error gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
    npm error gyp ERR! System Darwin 24.0.0
    npm error gyp ERR! command "/Users/instinct/.nvm/versions/node/v20.5.1/bin/node" "/Users/instinct/Desktop/anytype-ts/node_modules/.bin/node-gyp" "rebuild"
    npm error gyp ERR! cwd /Users/instinct/Desktop/anytype-ts/node_modules/keytar
    npm error gyp ERR! node -v v20.5.1
    npm error gyp ERR! node-gyp -v v9.4.1
    npm error gyp ERR! not ok
    npm error A complete log of this run can be found in: /Users/instinct/.npm/_logs/2024-11-05T13_03_56_759Z-debug-0.log

                    command=/Users/instinct/.nvm/versions/node/v20.5.1/bin/node /Users/instinct/Desktop/anytype-ts/node_modules/npm/bin/npm-cli.js rebuild keytar@7.9.0
                    workingDir=
npm ERR! code 1

Expected Behavior

It should install by following the instructions on README

Steps To Reproduce

  1. git clone the repo
  2. run npm i
  3. check the logged errors

Environment

- OS: macOS 15
- Version:

Anything else?

No response

ra3orblade commented 1 week ago

Python 3.12 and above does not contain setuptools and breaks node-gyp.

brew install python@3.11
uinstinct commented 1 week ago

Thanks for the tip! Installed python 3.11 using brew

I got another error on npm i -D again:

  • loaded configuration  file=package.json ("build" field)
  • rebuilding native dependencies  dependencies=keytar@7.9.0 platform=darwin arch=arm64
  ⨯ cannot execute  cause=exit status 1
                    errorOut=npm ERR! code 1
    npm ERR! path /Users/instinct/Desktop/anytype-ts/node_modules/keytar
    npm ERR! command failed
    npm ERR! command sh -c prebuild-install || npm run build
    npm ERR! > keytar@7.9.0 build
    npm ERR! > node-gyp rebuild
    npm ERR! gyp info it worked if it ends with ok
    npm ERR! gyp info using node-gyp@9.4.1
    npm ERR! gyp info using node@20.13.1 | darwin | arm64
    npm ERR! gyp info find Python using Python version 3.13.0 found at "/opt/homebrew/opt/python@3.13/bin/python3.13"
    npm ERR! gyp info spawn /opt/homebrew/opt/python@3.13/bin/python3.13
    npm ERR! gyp info spawn args [
    npm ERR! gyp info spawn args   '/Users/instinct/Desktop/anytype-ts/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/instinct/Desktop/anytype-ts/node_modules/keytar/build/config.gypi',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   '/Users/instinct/Desktop/anytype-ts/node_modules/node-gyp/addon.gypi',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   '/Users/instinct/.electron-gyp/33.0.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/instinct/.electron-gyp/33.0.1',
    npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Users/instinct/Desktop/anytype-ts/node_modules/node-gyp',
    npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/instinct/.electron-gyp/33.0.1/<(target_arch)/node.lib',
    npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/instinct/Desktop/anytype-ts/node_modules/keytar',
    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! Traceback (most recent call last):
    npm ERR!   File "/Users/instinct/Desktop/anytype-ts/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
    npm ERR!     import gyp  # noqa: E402
    npm ERR!     ^^^^^^^^^^
    npm ERR!   File "/Users/instinct/Desktop/anytype-ts/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
    npm ERR!     import gyp.input
    npm ERR!   File "/Users/instinct/Desktop/anytype-ts/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
    npm ERR!     from distutils.version import StrictVersion
    npm ERR! ModuleNotFoundError: No module named 'distutils'
    npm ERR! gyp ERR! configure error
    npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
    npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/Users/instinct/Desktop/anytype-ts/node_modules/node-gyp/lib/configure.js:325:16)
    npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:519:28)
    npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
    npm ERR! gyp ERR! System Darwin 24.0.0
    npm ERR! gyp ERR! command "/Users/instinct/.nvm/versions/node/v20.13.1/bin/node" "/Users/instinct/Desktop/anytype-ts/node_modules/.bin/node-gyp" "rebuild"
    npm ERR! gyp ERR! cwd /Users/instinct/Desktop/anytype-ts/node_modules/keytar
    npm ERR! gyp ERR! node -v v20.13.1
    npm ERR! gyp ERR! node-gyp -v v9.4.1
    npm ERR! gyp ERR! not ok

    npm ERR! A complete log of this run can be found in: /Users/instinct/.npm/_logs/2024-11-06T11_50_22_244Z-debug-0.log

                    command=/Users/instinct/.nvm/versions/node/v20.13.1/bin/node /Users/instinct/.nvm/versions/node/v20.13.1/lib/node_modules/npm/bin/npm-cli.js rebuild keytar@7.9.0
                    workingDir=
npm ERR! code 1
ra3orblade commented 1 week ago

You have still 3.13 trying to run by node-gyp, you should remove it

gyp info find Python using Python version 3.13.0 found at "/opt/homebrew/opt/python@3.13/bin/python3.13"
haron-IV commented 6 days ago

@ra3orblade You have pretty old stack here in the repo. Are there any plans to up it?

ra3orblade commented 2 days ago

@ra3orblade You have pretty old stack here in the repo. Are there any plans to up it?

of course there are, no time for this at the moment as there are some outdated dependencies and some code needs rework.