oxen-io / session-desktop

Session Desktop - Onion routing based messenger
https://getsession.org
GNU General Public License v3.0
1.43k stars 186 forks source link

[BUG] Windows: better-sqlite3 can't be compiled, because `distutils` is missing #3013

Closed martin-braun closed 5 months ago

martin-braun commented 5 months ago

Code of conduct

Self-training on how to write a bug report

Is there an existing issue for this?

Current Behavior

Output during yarn install --frozen-lockfile:

> @signalapp/better-sqlite3@8.5.2 download
> node ./deps/download.js

downloading https://build-artifacts.signal.org/desktop/sqlcipher-4.5.5-fts5-fix--3.0.7--0.2.1-ef53ea45ed92b928ecfd33c552d8d405263e86e63dec38e1ec63e1b0193b630b.tar.gz

> @signalapp/better-sqlite3@8.5.2 build-release
> node-gyp rebuild --release

gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.1
gyp info using node@18.15.0 | win32 | x64
gyp info find Python using Python version 3.12.1 found at "...\scoop\apps\python\current\python.exe"
gyp info find VS using VS2022 (17.8.34511.84) found at:
gyp info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
gyp info find VS run with --verbose for detailed information
gyp info spawn ...\scoop\apps\python\current\python.exe
gyp info spawn args [
gyp info spawn args   '...\\scoop\\persist\\nvm\\nodejs\\v18.15.0\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   '...\\node_modules\\@signalapp\\better-sqlite3\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '...\\scoop\\persist\\nvm\\nodejs\\v18.15.0\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '...\\AppData\\Local\\node-gyp\\Cache\\18.15.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=...\\AppData\\Local\\node-gyp\\Cache\\18.15.0',
gyp info spawn args   '-Dnode_gyp_dir=...\\scoop\\persist\\nvm\\nodejs\\v18.15.0\\node_modules\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=...\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\18.15.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=...\\node_modules\\@signalapp\\better-sqlite3',
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   '...\\node_modules\\@signalapp\\better-sqlite3\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
Traceback (most recent call last):
  File "...\scoop\persist\nvm\nodejs\v18.15.0\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 42, in <module>
    import gyp  # noqa: E402
    ^^^^^^^^^^
  File "...\scoop\persist\nvm\nodejs\v18.15.0\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 9, in <module>
    import gyp.input
  File "...\scoop\persist\nvm\nodejs\v18.15.0\node_modules\npm\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 (...\scoop\persist\nvm\nodejs\v18.15.0\node_modules\npm\node_modules\node-gyp\lib\configure.js:325:16)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Windows_NT 10.0.22621
gyp ERR! command "...\\scoop\\apps\\nvm\\current\\nodejs\\nodejs\\node.exe" "...\\scoop\\persist\\nvm\\nodejs\\v18.15.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--release"
gyp ERR! cwd ...\node_modules\@signalapp\better-sqlite3
gyp ERR! node -v v18.15.0

Expected Behavior

Should install and compile dependencies.

Steps To Reproduce

Start the VS Dev Prompt, then nvm use 18 && yarn install --frozen-lockfile.

Desktop Version

No response

Anything else?

martin-braun commented 5 months ago

Solved by https://github.com/WiseLibs/better-sqlite3/issues/1093