
INFO: Could not find files for the given pattern(s) message appears on Windows
快速结论:该报错发生在 Windows 系统下启动 Gradio 应用(5.6.0+)时,根本原因是 Gradio 内部探测 Node.js 安装路径的 where node 命令输出被泄漏到控制台。若系统未安装 Node.js 或不位于 PATH,该消息每次启动必现。
问题场景
用户在 Windows 11(或部分 Windows 10 版本)上运行基于 Gradio 5.6.0 及以上版本编写的 Python WebUI 应用时(例如 demo.launch()),控制台无端打印 INFO: Could not find files for the given pattern(s). 消息。即使将 Python logging 设置为 logging.NullHandler(),该消息依然出现,表明它不是由 Python logging 模块发出的。
报错原文
INFO: Could not find files for the given pattern(s).
原因分析
该报错由 Gradio gradio/utils.py 中 get_node_path() 函数内部调用 Windows where 命令探测 Node.js 路径时产生。具体来说,当系统未安装 Node.js 或 node 不在系统 PATH 中时,subprocess.check_output(["where", "node"]) 只捕获了 stdout,而 where 命令将报错信息写入 stderr——该 stderr 泄漏到用户控制台,从而显示 INFO: Could not find files for the given pattern(s).。该消息在 Linux 下不会出现(使用 which 命令的行为不同),也不影响 Gradio 正常功能。
环境排查
- 确认操作系统是否为 Windows 11 或部分 Windows 10。
- 检查系统中是否安装了 Node.js(
node --version);若未安装,则可能触发该信息。 - 确认 Gradio 版本是否为 5.6.0 或更高(小于 5.6.0 无此问题)。
- 不影响 Python、PyTorch、CUDA 等环境配置。
解决步骤
- 可优先尝试:安装 Node.js(确保
node位于系统 PATH 中),重新启动应用,消息应消失。 - 若不想安装 Node.js,可自行修改 Gradio 源码中的
gradio/utils.py文件,定位到def get_node_path()函数,将:windows_path = subprocess.check_output(["where", "node"]).decode().strip().split("\r\n")[0]修改为:
windows_path = subprocess.check_output(["where", "node"], stderr=subprocess.DEVNULL).decode().strip().split("\r\n")[0](注意:此修改为非官方修改,仅在 Issue 讨论中被社区验证有效)
- 等待 Gradio 官方合并修复 PR(已确认修复方案为
stderr=subprocess.DEVNULL,参考 Puneet15556 的修复分支)。
验证方法
重启 Gradio 应用后,观察控制台是否仍然打印 INFO: Could not find files for the given pattern(s).。若该行消失,则表示问题已解决。



![[Bug]: Bug Report: Base64 Image String Being Split into Individual Characters](https://www.chat-gpts.plus/wp-content/uploads/2026/07/9302-a8607eee-768x403.jpg)