electron 我得到进口gyp错误时,试图安装包的电子

ghhaqwfi  于 6个月前  发布在  Electron
关注(0)|答案(1)|浏览(98)

我尝试在Windows上安装来自此存储库的演示:https://github.com/Seo-Rii/electron-acrylic-window

git clone https://github.com/Seo-Rii/electron-acrylic-window.git
cd electron-acrylic-window
yarn install

字符串
但安装返回下一个错误:

npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated [email protected]: This module is not used anymore, and has been replaced by @npmcli/package-json
npm ERR! code 1
npm ERR! path E:\test\electron-acrylic-window\node_modules\@seorii\win32-displayconfig
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c npm run rebuild
npm ERR! > @seorii/[email protected] rebuild
npm ERR! > node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info find Python using Python version 3.12.0 found at "C:\Users\Aptyp\AppData\Local\Programs\Python\Python312\python.exe"
npm ERR! gyp info find VS using VS2022 (17.6.33829.357) found at:
npm ERR! gyp info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:\Users\Aptyp\AppData\Local\Programs\Python\Python312\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'E:\\test\\electron-acrylic-window\\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   'msvs',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'E:\\test\\electron-acrylic-window\\node_modules\\@seorii\\win32-displayconfig\\build\\config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'E:\\test\\electron-acrylic-window\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\Aptyp\\AppData\\Local\\node-gyp\\Cache\\20.10.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=C:\\Users\\Aptyp\\AppData\\Local\\node-gyp\\Cache\\20.10.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=E:\\test\\electron-acrylic-window\\node_modules\\node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\Aptyp\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\20.10.0\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=E:\\test\\electron-acrylic-window\\node_modules\\@seorii\\win32-displayconfig',
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   'E:\\test\\electron-acrylic-window\\node_modules\\@seorii\\win32-displayconfig\\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 "E:\test\electron-acrylic-window\node_modules\node-gyp\gyp\gyp_main.py", line 42, in <module>
npm ERR!     import gyp  # noqa: E402
npm ERR!     ^^^^^^^^^^
npm ERR!   File "E:\test\electron-acrylic-window\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 9, in <module>
npm ERR!     import gyp.input
npm ERR!   File "E:\test\electron-acrylic-window\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 (E:\test\electron-acrylic-window\node_modules\node-gyp\lib\configure.js:259:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
npm ERR! gyp ERR! System Windows_NT 10.0.22000
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "E:\\test\\electron-acrylic-window\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd E:\test\electron-acrylic-window\node_modules\@seorii\win32-displayconfig
npm ERR! gyp ERR! node -v v20.10.0
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok


我安装了最后一个Python和Visual Studio,但没有任何积极的效果。我看了很多资料,但仍然不明白它缺少什么。这是我第一次认识电子

n3ipq98p

n3ipq98p1#

首先,确保你真的想使用这个库。它的最后一次更新是在两年前,它似乎不再维护了。
您得到此错误是因为兼容性问题。根据日志,您使用:用途:

node-gyp v8.4.1
node v20.10.0
Python v3.12.0

字符串
你得到的错误是:

ModuleNotFoundError: No module named 'distutils'


这是因为distutils在Python v3.12中被删除了。要解决这个问题,你需要升级node-gyp的版本(到v10+),或者降级你的Python版本(可能还有NodeJS)。

附加说明:

  • MacOS #7898上的vibrancy API原生提供透明效果
  • 自Electron v24.4.0以来,透明效果也应该适用于Windows,但API目前不稳定#38163

相关问题