You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
在 macOS 上使用 NapCat Mac Installer 接管 QQ 后,尝试切回原版 QQ 时,原版 QQ 仍然会加载 loadNapCat.js,并在 Electron 主进程中崩溃:
A JavaScript error occurred in the main process
Uncaught Exception:
TypeError: Cannot read properties of undefined (reading 'installPathPkgJson')
at Immediate.<anonymous> (~/Library/Containers/com.tencent.qq/Data/Documents/loadNapCat.js:10:25)
这看起来不是业务代码问题,而是 Mac 版 QQ 热更新包的启动入口没有一起恢复,导致“看起来打开的是原版 QQ”,实际仍然进入了 NapCat loader。
环境
系统:macOS 26.0
架构:arm64
NapCat:4.18.9
安装方式:NapCat Mac Installer
QQ 基础包:6.9.82-40990
QQ 热更新包:6.9.96-49738
基础包入口:
/Applications/QQ.app/Contents/Resources/app/package.json
main = ./application.asar/app_launcher/index.js
On macOS, after switching back from NapCat to original QQ, the base QQ app package.json may be restored, but the QQ hot-update package under ~/Library/Containers/com.tencent.qq/Data/Library/Application Support/QQ/versions/<curVersion>/QQUpdate.app/.../package.json can still point to Documents/loadNapCat.js.
As a result, original QQ still loads NapCat's loader and crashes because global.launcher.installPathPkgJson is undefined. Restoring the hot-update package.json main back to ./application.asar/app_launcher/index.js fixes the local issue.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
问题描述
在 macOS 上使用 NapCat Mac Installer 接管 QQ 后,尝试切回原版 QQ 时,原版 QQ 仍然会加载
loadNapCat.js,并在 Electron 主进程中崩溃:这看起来不是业务代码问题,而是 Mac 版 QQ 热更新包的启动入口没有一起恢复,导致“看起来打开的是原版 QQ”,实际仍然进入了 NapCat loader。
环境
基础包入口:
但实际运行时 QQ 会加载热更新包:
该热更新包的
main仍然是:复现路径
/Applications/QQ.app/Contents/Resources/app/package.json的main为原版入口。installPathPkgJsonundefined。实际结果
虽然基础包入口已经恢复为原版,但 QQ 启动器会走热更新目录中的
QQUpdate.app。如果热更新包的package.json仍指向Documents/loadNapCat.js,原版 QQ 启动时还是会进入 NapCat loader。当前本地的
loadNapCat.js中有类似逻辑:但在这个 QQ 热更新版本的原版启动环境里,
global.launcher可能是undefined,于是主进程直接崩溃。期望结果
从 NapCat 切回原版 QQ 时,应该满足至少一个条件:
package.json入口;loadNapCat.js的原版 QQ fallback 分支对global.launcher/installPathPkgJson做判空,避免直接崩溃;本地临时解决方式
本地通过以下方式恢复:
package.json;loadNapCat.js中的global.launcher.installPathPkgJson访问加判空保护。恢复后,QQ 不再进入
loadNapCat.js,能以原版入口启动。可能的修复方向
找到当前
curVersion,并同步恢复:loadNapCat.js对global.launcher做保护,例如:English summary
On macOS, after switching back from NapCat to original QQ, the base QQ app package.json may be restored, but the QQ hot-update package under
~/Library/Containers/com.tencent.qq/Data/Library/Application Support/QQ/versions/<curVersion>/QQUpdate.app/.../package.jsoncan still point toDocuments/loadNapCat.js.As a result, original QQ still loads NapCat's loader and crashes because
global.launcher.installPathPkgJsonis undefined. Restoring the hot-update package.json main back to./application.asar/app_launcher/index.jsfixes the local issue.All reactions