Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Linux 下不支持 fs.watch 的 recursive: true 选项 #115

Closed
arenekosreal opened this issue Feb 18, 2024 · 4 comments
Closed

[Bug]: Linux 下不支持 fs.watch 的 recursive: true 选项 #115

arenekosreal opened this issue Feb 18, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@arenekosreal
Copy link

重现步骤

在 Linux 下安装 lite_tools 并且从终端启动 QQ,可能需要打开本地表情?
发现带有输出

[轻量工具箱]撤回管理>  新的历史记录实例,目标文件 latestRecallMessage.json 实例状态 读写 切片大小 100
(node:2) UnhandledPromiseRejectionWarning: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
    at new NodeError (node:internal/errors:405:5)
    at Object.watch (node:fs:2416:11)
    at loadEmoticons (/home/zhanghua/.var/app/com.qq.QQ.Liteloadered/config/LiteLoaderQQNT/plugins/lite_tools_v4/src/main_modules/localEmoticons.js:22:16)
(Use `qq --trace-warnings ...` to show where the warning was created)

原因为 nodejs 18 还不支持 linux 下使用 recursive: true 给 fs.watch
出问题的代码:https://github.com/xiyuesaves/LiteLoaderQQNT-lite_tools/blob/v4/src/main_modules/localEmoticons.js#L24
建议修正:Linux 下检查 nodejs 版本号,目前只有 18.13 这个 LTS 版本及 19 和以后的版本可以支持 recursive: true 参数
参见:nodejs/node#45098

@arenekosreal arenekosreal added the bug Something isn't working label Feb 18, 2024
@xiyuesaves
Copy link
Owner

抱歉,我这边没有Linux测试环境,目前只有找其他人测试此问题,临时解决方案是禁用 Linux 平台下的本地表情目录监听功能,直到 QQ Linux 使用的 nodejs 版本支持此选项后再启用,这可能会对功能造成一定影响。

@xihale
Copy link

xihale commented Feb 18, 2024

原因大概在 Linux 的 libuv 没有支持原生的 recursive watch
node 后来对于此的 patch: https://github.com/nodejs/node/blob/v20.2.0/lib/internal/fs/recursive_watch.js#L137 也是递归处理, 所以直接递归处理所有文件夹即可

@xiyuesaves
Copy link
Owner

xiyuesaves commented Feb 18, 2024

已尝试修复此问题,但还需要在Linux环境下测试

@xihale
Copy link

xihale commented Feb 18, 2024

已尝试修复此问题,但还需要在Linux环境下测试

Linux 环境下简单测试后没有发现问题!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants