[英]running Chrome in headless mode
To run chrome in headless mode , I did为了在无头模式下运行chrome ,我做到了
alias chrome="/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome"
别名 chrome="/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome"
chrome --remote-debugging-port=9222 --disable-gpu --headless
铬 --remote-debugging-port=9222 --disable-gpu --headless
in console, But, I got this error,在控制台中,但是,我收到了这个错误,
[0305/140111.481537:ERROR:xattr.cc(64)] setxattr org.chromium.crashpad.database.initialized on file /var/folders/m3/92mmh21n0cx4ppf8c3bcns38hd4_kk/T/: Operation not permitted (1) [0305/140111.484254:ERROR:xattr.cc(64)] setxattr org.chromium.crashpad.database.initialized on file /var/folders/m3/92mmh21n0cx4ppf8c3bcns38hd4_kk/T/: Operation not permitted (1) [0305/140111.484254:INFO:crashpad_client_mac.cc(292)] restarting handler in 0.983s [0305/140111.513641:ERROR:gpu_process_transport_factory.cc(1009)] Lost UI shared context.
[0305/140111.481537:ERROR:xattr.cc(64)] setxattr org.chromium.crashpad.database.initialized on file /var/folders/m3/92mmh21n0cx4ppf8c3bcns38hd4_kk/T/: 不允许操作 (ERROR4031041515) (ERROR4031041515) :xattr.cc(64)] setxattr org.chromium.crashpad.database.initialized 文件 /var/folders/m3/92mmh21n0cx4ppf8c3bcns38hd4_kk/T/: 不允许操作 (1) [0305/140111:4849FOMC. )] 在 0.983 秒内重新启动处理程序 [0305/140111.513641:ERROR:gpu_process_transport_factory.cc(1009)] 丢失 UI 共享上下文。 [0305/140111.513709:ERROR:instance.cc(49)] Unable to locate service manifest for metrics [0305/140111.513733:ERROR:service_manager.cc(890)] Failed to resolve service name: metrics [0305/140111.514229:ERROR:socket_posix.cc(142)] bind() returned an error, errno=48: Address already in use (48)
[0305/140111.513709:ERROR:instance.cc(49)] 无法定位指标的服务清单 [0305/140111.513733:ERROR:service_manager.cc(890)] 未能解析服务名称:指标 [0305/140111.513733:metrics [0305/140111.513733:ERROR:service_manager.cc(890)] .cc(142)] bind() 返回错误,errno=48:地址已被使用 (48)
DevTools listening on ws://[::1]:9222/devtools/browser/c46563ca-1891-48bd-bdd6-e6122f3f3b5d [0305/140112.484141:ERROR:xattr.cc(64)] setxattr org.chromium.crashpad.database.initialized on file /var/folders/m3/92mmh21n0cx4ppf8c3bcns38hd4_kk/T/: Operation not permitted (1) [0305/140112.484641:INFO:crashpad_client_mac.cc(292)] restarting handler in 0.985s [0305/140113.489618:ERROR:xattr.cc(64)] setxattr org.chromium.crashpad.database.initialized on file /var/folders/m3/92mmh21n0cx4ppf8c3bcns38hd4_kk/T/: Operation not permitted (1) [0305/140113.490274:INFO:crashpad_client_mac.cc(292)] restarting handler in 0.979s [0305/140114.484881:ERROR:xattr.cc(64)] setxattr org.chromium.crashpad.database.initialized on file /var/folders/m3/92mmh21n0cx4ppf8c3bcns38hd4_kk/T/: Operation not permitted (1) [0305/140114.485349:INFO:crashpad_client_mac.cc(292)] restarting handler in 0.985s [0305/140115.489188:ERROR:xattr.cc(64)] setxattr org.chromium.crashpad.database.initialized on file /var/folders/m3/92mmh2
DevTools 监听 ws://[::1]:9222/devtools/browser/c46563ca-1891-48bd-bdd6-e6122f3f3b5d [0305/140112.484141:ERROR:xattr.cc(64)] setxattium.sh .在文件 /var/folders/m3/92mmh21n0cx4ppf8c3bcns38hd4_kk/T/ 上初始化:操作不允许 (1) [0305/140112.484641:INFO:crashpad_client_mac.cc(292)] 在 [0.43901855s.103901855s.10390185s.ERROR] 中重新启动处理程序: cc(64)] setxattr org.chromium.crashpad.database.initialized 在文件 /var/folders/m3/92mmh21n0cx4ppf8c3bcns38hd4_kk/T/ 上:操作不允许 (1) [0305/140113.490274:INFO:ccrestart] 0.979 秒内的处理程序 [0305/140114.484881:ERROR:xattr.cc(64)] setxattr org.chromium.crashpad.database.initialized 在文件 /var/folders/m3/92mmh21n0cx4ppf8c3bcns38/:T5038hd4_0 上初始化(不允许操作) /140114.485349:INFO:crashpad_client_mac.cc(292)] 在 0.985 秒内重新启动处理程序 [0305/140115.489188:ERROR:xattr.cc(64)] setxattr org.chromium.crashpad.database/initializers/filedm 92mmh2 1n0cx4ppf8c3bcns38hd4_kk/T/: Operation not permitted (1) [0305/140115.489638:INFO:crashpad_client_mac.cc(292)] restarting handler in 0.985s
1n0cx4ppf8c3bcns38hd4_kk/T/: 不允许操作 (1) [0305/140115.489638:INFO:crashpad_client_mac.cc(292)] 在 0.985s 内重新启动处理程序
I also tried,我也试过,
/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --remote-debugging-port=9222 --disable-gpu --headless
/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --remote-debugging-port=9222 --disable-gpu --headless
but I got same error.但我遇到了同样的错误。
Is there any solution for this?有什么解决办法吗?
I got the answer from Chrome crashpad crashes on xattr我从Chrome crashpad 在 xattr 上崩溃得到了答案
Just provide a different directory for "crash dumps" when starting Chrome, like this:只需在启动 Chrome 时为“崩溃转储”提供一个不同的目录,如下所示:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --disable-gpu --headless --crash-dumps-dir=/tmp
UPDATE 3/6更新 3/6
I checked the solution on my own MacBook and it worked.我在自己的 MacBook 上检查了解决方案,它奏效了。
I encounter the same issue today, and after searching some document, I suspect it's due to the SIP(System Integrity Protection) feature in MacOS, with that restrict, you can't modify the files under /var
folder even you have the root privilege.我今天遇到了同样的问题,在搜索了一些文档后,我怀疑这是由于 MacOS 中的SIP(系统完整性保护)功能,由于该限制,即使您具有 root 权限,您也无法修改
/var
文件夹下的文件.
So here is the way to disable that feature:所以这里是禁用该功能的方法:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.