BlueBubblesApp / bluebubbles-server

Server for forwarding iMessages to clients within the BlueBubbles App ecosystem
https://bluebubbles.app
Apache License 2.0
540 stars 47 forks source link

Unable to install dependencies for dev environment: node-mac-contacts #686

Closed joshuafhiggins closed 1 month ago

joshuafhiggins commented 1 month ago

Hey I'm running into an issue trying to setup a dev environment that's failing at node-mac-contacts, I'm unsure if this is related or unrelated to the move away from Yarn. I do have python installed and have tried running npm install and yarn. This is what I get when it fails:

error /Users/joshuafhiggins/GitHub/BlueBubbles-Server/node_modules/node-mac-permissions: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /Users/joshuafhiggins/GitHub/BlueBubbles-Server/node_modules/node-mac-permissions
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@9.4.1
gyp info using node@22.6.0 | darwin | arm64
(node:54997) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
gyp info find Python using Python version 3.12.5 found at "/Library/Frameworks/Python.framework/Versions/3.12/bin/python3"
gyp info spawn /Library/Frameworks/Python.framework/Versions/3.12/bin/python3
gyp info spawn args [
gyp info spawn args   '/Users/joshuafhiggins/GitHub/BlueBubbles-Server/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/joshuafhiggins/GitHub/BlueBubbles-Server/node_modules/node-mac-permissions/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/joshuafhiggins/GitHub/BlueBubbles-Server/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/joshuafhiggins/Library/Caches/node-gyp/22.6.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/joshuafhiggins/Library/Caches/node-gyp/22.6.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/joshuafhiggins/GitHub/BlueBubbles-Server/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/joshuafhiggins/Library/Caches/node-gyp/22.6.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/joshuafhiggins/GitHub/BlueBubbles-Server/node_modules/node-mac-permissions',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
Traceback (most recent call last):
  File "/Users/joshuafhiggins/GitHub/BlueBubbles-Server/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
    import gyp  # noqa: E402
    ^^^^^^^^^^
  File "/Users/joshuafhiggins/GitHub/BlueBubbles-Server/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
    import gyp.input
  File "/Users/joshuafhiggins/GitHub/BlueBubbles-Server/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/joshuafhiggins/GitHub/BlueBubbles-Server/node_modules/node-gyp/lib/configure.js:325:16)
gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
gyp ERR! System Darwin 24.0.0
gyp ERR! command "/opt/homebrew/Cellar/node/22.6.0/bin/node" "/Users/joshuafhiggins/GitHub/BlueBubbles-Server/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/joshuafhiggins/GitHub/BlueBubbles-Server/node_modules/node-mac-permissions
zlshames commented 1 month ago

Yeah for some reason, yarn doesn't work well with the project after we upgraded electron/NodeJS to a later version. Now we just need to use npm. So delete your yarn lock and what not.

Also, after some research, distutils was removed from python in v3.12, which is what you're using. Consider downgrading I guess

joshuafhiggins commented 1 month ago

Got it! For others with the same problem, use Python 3.10.

Also there are other build problems I'm going to sort out on Sequoia with node-mac-contacts, I believe there was an API change in how contact permissions are asked for and received (at least there was on iOS but they usually also appear on macOS too)