GregVido / mica-electron

Library to add mica effect of windows 11 in electron app
Apache License 2.0
126 stars 7 forks source link

mac下无法安装,提示 fatal error: 'dwmapi.h' file not found #15

Closed Godzillas closed 1 year ago

Godzillas commented 1 year ago
➜  SysMocap git:(main) npm install mica-electron
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
npm WARN lifecycle The node binary used for scripts is /opt/homebrew/opt/node@14/bin/node but npm is using /opt/homebrew/Cellar/node@14/14.21.2_1/libexec/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> mica-electron@1.3.2 install /Users/jun/github/SysMocap/node_modules/mica-electron
> node-gyp rebuild

  CXX(target) Release/obj.target/micaElectron/dwmExec.o
../dwmExec.cc:17:9: warning: unknown pragma ignored [-Wunknown-pragmas]
#pragma warning(disable: 4996) // GetVersion() was declared deprecated
        ^
../dwmExec.cc:18:9: warning: unknown pragma ignored [-Wunknown-pragmas]
#pragma warning(disable: 4312) // long -> HWND size >
        ^
In file included from ../dwmExec.cc:21:
../dwmExec.h:1:10: fatal error: 'dwmapi.h' file not found
#include <dwmapi.h>
         ^~~~~~~~~~
2 warnings and 1 error generated.
make: *** [Release/obj.target/micaElectron/dwmExec.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/opt/homebrew/Cellar/node@14/14.21.2_1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
gyp ERR! System Darwin 22.3.0
gyp ERR! command "/opt/homebrew/Cellar/node@14/14.21.2_1/libexec/node" "/opt/homebrew/Cellar/node@14/14.21.2_1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jun/github/SysMocap/node_modules/mica-electron
gyp ERR! node -v v14.21.2
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm WARN @pixiv/three-vrm@0.6.11 requires a peer of @types/three@^0.137.0 but none is installed. You must install peer dependencies yourself.
npm WARN svelte-awesome@3.0.0 requires a peer of svelte@^3.43.1 but none is installed. You must install peer dependencies yourself.
npm WARN svelte-simple-modal@1.4.1 requires a peer of svelte@^3.31.2 but none is installed. You must install peer dependencies yourself.
npm WARN sysmocap@0.5.8 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mica-electron@1.3.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the mica-electron@1.3.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jun/.npm/_logs/2023-03-06T09_33_25_881Z-debug.log

安装 SysMocap 依赖的时候报错,电脑环境 node v14.21.2 M1 MacBook Air

GregVido commented 1 year ago

Hello, dwmapi.h is a windows API, it doesn't exist on mac. For have transparent effect on mac, you need to use visualEffectState in BrowserWindow options, you can see here : https://www.electronjs.org/docs/latest/api/browser-window

tonylu110 commented 1 year ago

如果你想让windows和mac同时编译或执行,你可以选择在给mac重新写一个main.js来运行,mac的有官方的毛玻璃支持,可以参看官方文档