mac-screen-capture-permissions 模块在 Mac OS Catalina 10.15.7 上失败
Posted
技术标签:
【中文标题】mac-screen-capture-permissions 模块在 Mac OS Catalina 10.15.7 上失败【英文标题】:mac-screen-capture-permissions module make failed at Mac OS Catalina 10.15.7 【发布时间】:2021-07-26 13:34:53 【问题描述】:我想从 github 运行 jitsi meet electron 项目。所以我尝试在我的项目目录中安装 npm install 来安装必要的节点模块包。在此期间发生了以下错误。
错误:函数“CGPreflightScreenCaptureAccess”的隐式声明在 C99 中无效 [-Werror,-Wimplicit-function-declaration] hasPermissions = CGPreflightScreenCaptureAccess();
在 package.json 文件中: "mac-screen-capture-permissions": "^1.1.0"
完全错误:
> mac-screen-capture-permissions@1.1.0 install /Users/apple01/Documents/Boithok/jitsi-meet-electron-master/node_modules/mac-screen-capture-permissions
> prebuild-install || node install.js
prebuild-install WARN install No prebuilt binaries found (target=14.16.1 runtime=node arch=x64 libc= platform=darwin)
> mac-screen-capture-permissions@1.1.0 native_build /Users/apple01/Documents/Boithok/jitsi-meet-electron-master/node_modules/mac-screen-capture-permissions
> node-gyp rebuild
CXX(target) Release/obj.target/screencapturepermissions/screen-capture-permissions.o
../screen-capture-permissions.m:12:22: error: implicit declaration of function 'CGPreflightScreenCaptureAccess' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
hasPermissions = CGPreflightScreenCaptureAccess();
^
1 error generated.
make: *** [Release/obj.target/screencapturepermissions/screen-capture-permissions.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/Cellar/node@14/14.16.1_1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/usr/local/Cellar/node@14/14.16.1_1/bin/node" "/usr/local/Cellar/node@14/14.16.1_1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/apple01/Documents/Boithok/jitsi-meet-electron-master/node_modules/mac-screen-capture-permissions
gyp ERR! node -v v14.16.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mac-screen-capture-permissions@1.1.0 native_build: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mac-screen-capture-permissions@1.1.0 native_build 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/apple01/.npm/_logs/2021-05-04T05_46_57_224Z-debug.log
> robotjs@0.6.0 install /Users/apple01/Documents/Boithok/jitsi-meet-electron-master/node_modules/robotjs
> prebuild-install || node-gyp rebuild
prebuild-install WARN install No prebuilt binaries found (target=14.16.1 runtime=node arch=x64 libc= platform=darwin)
CXX(target) Release/obj.target/robotjs/src/robotjs.o
CC(target) Release/obj.target/robotjs/src/deadbeef_rand.o
CC(target) Release/obj.target/robotjs/src/mouse.o
CC(target) Release/obj.target/robotjs/src/keypress.o
CC(target) Release/obj.target/robotjs/src/keycode.o
CC(target) Release/obj.target/robotjs/src/screen.o
CC(target) Release/obj.target/robotjs/src/screengrab.o
CC(target) Release/obj.target/robotjs/src/snprintf.o
CC(target) Release/obj.target/robotjs/src/MMBitmap.o
SOLINK_MODULE(target) Release/robotjs.node
【问题讨论】:
【参考方案1】:该模块无法在 macOS 10.15.7 上编译,因为它 CGPreflightScreenCaptureAccess
在该版本上不可用。在运行时,模块会在调用该 API 之前检查 macOS 版本,因此它不会崩溃。
从源代码构建模块需要 macOS 11+ SDK,但生成的模块仍将在
【讨论】:
以上是关于mac-screen-capture-permissions 模块在 Mac OS Catalina 10.15.7 上失败的主要内容,如果未能解决你的问题,请参考以下文章