原文发表在知乎,这里是转载。https://zhuanlan.zhihu.com/p/660102125。B站的文本编辑器太难用了,很多图片很难拷贝过来,还需要一个一个上传。我后续会慢慢完善
学习和使用ComfyUI最痛苦的是什么?就是这满屏的红色方框和和报错信息,处理完一批又一批,很多人玩了一两个流程就搞不下去了,很多初学者因此就放弃了。
如果你想克服困难继续学习,体验comfyUI给你带来的高效和快感,希望这篇文章能帮助解决常见的技术问题,让你畅快使用ComfyUI。

最近因为部分SD的流程需要自动化,批量化,所以开始搞ComfyUI,我搞了一个多月了,期间经历过各种问题,由于是技术出身,对troubleshooting本身就执着,所以一步一步的解决问题过程中积累了很多经验,同时也在网上做一些课程,帮助一些非技术出身的小白学员入门了comfyUI.希望通过本文就记录一些安装和使用的常见问题,让大家踩坑后能尽快解决吧。其实github上issue里面也有很多有用的内容,如果英文好的小伙伴可以直接去哪里解决。 以我的使用经验问题大多出在各种Custom node安装和模型下载上,另外由于开源组件更新快,很多相关组件都需要及时更新到最新版本,所以有些时候出了问题,把相关的包更新一下,问题就可能解决了。
3.ComfyUI节点的安装 a. 发现缺失的节点 很多人说用Manager,节点管理器来管理custom node,但是现实情况是国内由于墙的原因,经常下载失败。 所以学会手动安装是ComfyUI必备技能。如果你引入的流程上,出现大量的红色节点和红色的提示,那么说明你缺少对应节点, 你可以首先点击"Install Missing Custom Nodes 这个时候注意,要开着科学上网,因为它要访问这个两个github的网址 FETCH DATA from: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json FETCH DATA from: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json 你点击Install后, 虽然显示安装成功,并且让你重新启动,但是不要被表面现象迷惑,很可能安装是失败的。 只有如下图显示了紫色disable和红色uninstall的色块才是安装成功的标志. 要在文件浏览器里检查,对应的文件夹是不是出现了, ComfyUI/custom_nodes下按照时间排序,看看有没有当前时间段创建的文件夹,如果没有说明需要手工安装. 通过两个方式拿到节点的git库地址,一是点击install之后看后台的信息, 看到有git clone https://....
b.手工安装节点node 可以打开一个cmd窗口,进到comfyUI/custom_node路径下,把命令拷贝过去 git clone 'https://...',这会儿不要执行,因为访问git需要加一个代理。 你可以把引号删除,同时加上 https://ghproxy.com/https://github.com/... 如图所示: ghproxy是非常好用的git 代理。 非常推荐大家使用。 注:我个人使用是comfyUI开两个窗口,不要直接点run_nvidia_gpu.bat 这个文件启动,开一个cmd窗口或者poweshell,进入命令行启动它,因为后面安装节点要反复执行这个命令,你这个窗口只需要按ctrl+c 停止服务器,再按上箭头和回车就可以重新启动新的comfyUI,效率高很多。另外一个窗口只负责更新节点和python库,也省去了每次都要新开窗口进入custom nodes路径的时间。
c.安装python包 有些节点如果重启后还是import failed,可能是需要你手工安装一些python包,你需要仔细查看对应github库的readme.md文件。 在启动时,会报一些 No module named xxxx 这类错误信息,那就是需要手动安装这些包。 像下面这个示例中charactor face swap包,就写明了手动安装时,需要执行的命令 这时可以进入另一个专门安装包和节点的窗口。执行..\..\..\python_embeded\python install.py 注意linux环境和windows环境斜杠方向不同。 这里面要注意一下,其实install.py是comfyUI启动或安装时会自动调用的脚本.只不过由于我们有些时候安装不成功才需要执行它。另外一些节点常见的安装过程是需要 ..\..\..\python_embeded\python -m pip install -r requirements.txt 来手动安装各种python包。 我的这种安装方式适用于安装portable包的小伙伴,要是你通过venv或者conda环境安装的comfyUI,那你直接用pip就好了。 还有些节点需要额外的安装步骤,请自行仔细阅读开源项目的readme.md文件,答案都在那里。 d.一些特殊的节点 有些特殊的节点,其实只是一个python文件,你下载了github文件夹后还需要把文件直接放到custom_nodes的目录下。比如这个clipseg节点组件。 还有这几个组件.
e.网络不通怎么办?
如果网络不通,一般会报"[WinError 121]信号灯超时时间已到”或者 Error handling request Traceback (most recent call last): File "C:\DEV\ComfyUI_windows_portable\python_embeded\lib\site-packages\aiohttp\web_protocol.py", line 433, in _handle_request resp = await request_handler(request) File "C:\DEV\ComfyUI_windows_portable\python_embeded\lib\site-packages\aiohttp\web_app.py", line 504, in _handle resp = await handler(request) File "C:\DEV\ComfyUI_windows_portable\python_embeded\lib\site-packages\aiohttp\web_middlewares.py", line 117, in impl return await handler(request) File "C:\DEV\ComfyUI_windows_portable\ComfyUI\server.py", line 46, in cache_control response: web.Response = await handler(request) File "C:\DEV\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager\__init__.py", line 522, in fetch_customnode_mappings json_obj = await get_data(uri) File "C:\DEV\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager\__init__.py", line 367, in get_data async with session.get(uri) as resp: File "C:\DEV\ComfyUI_windows_portable\python_embeded\lib\site-packages\aiohttp\client.py", line 1141, in __aenter__ self._resp = await self._coro File "C:\DEV\ComfyUI_windows_portable\python_embeded\lib\site-packages\aiohttp\client.py", line 560, in _request await resp.start(conn) File "C:\DEV\ComfyUI_windows_portable\python_embeded\lib\site-packages\aiohttp\client_reqrep.py", line 899, in start message, payload = await protocol.read() # type: ignore[union-attr] File "C:\DEV\ComfyUI_windows_portable\python_embeded\lib\site-packages\aiohttp\streams.py", line 616, in read await self._waiter aiohttp.client_exceptions.ClientOSError: [WinError 121] 信号灯超时时间已到 无法连接github的错误信息"Cannot connect to host raw.githubusercontent.com:443 ssl:default [None]" Traceback (most recent call last): File "C:\DEV\ComfyUI_windows_portable\python_embeded\lib\site-packages\aiohttp\web_protocol.py", line 433, in _handle_request resp = await request_handler(request) File "C:\DEV\ComfyUI_windows_portable\python_embeded\lib\site-packages\aiohttp\web_app.py", line 504, in _handle resp = await handler(request) File "C:\DEV\ComfyUI_windows_portable\python_embeded\lib\site-packages\aiohttp\web_middlewares.py", line 117, in impl return await handler(request) File "C:\DEV\ComfyUI_windows_portable\ComfyUI\server.py", line 46, in cache_control response: web.Response = await handler(request) File "C:\DEV\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager\__init__.py", line 582, in fetch_customnode_list json_obj = await get_data(uri) File "C:\DEV\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager\__init__.py", line 367, in get_data async with session.get(uri) as resp: File "C:\DEV\ComfyUI_windows_portable\python_embeded\lib\site-packages\aiohttp\client.py", line 1141, in __aenter__ self._resp = await self._coro File "C:\DEV\ComfyUI_windows_portable\python_embeded\lib\site-packages\aiohttp\client.py", line 536, in _request conn = await self._connector.connect( File "C:\DEV\ComfyUI_windows_portable\python_embeded\lib\site-packages\aiohttp\connector.py", line 540, in connect proto = await self._create_connection(req, traces, timeout) File "C:\DEV\ComfyUI_windows_portable\python_embeded\lib\site-packages\aiohttp\connector.py", line 899, in _create_connection _, proto = await self._create_proxy_connection(req, traces, timeout) File "C:\DEV\ComfyUI_windows_portable\python_embeded\lib\site-packages\aiohttp\connector.py", line 1328, in _create_proxy_connection return await self._start_tls_connection( File "C:\DEV\ComfyUI_windows_portable\python_embeded\lib\site-packages\aiohttp\connector.py", line 1111, in _start_tls_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host raw.githubusercontent.com:443 ssl:default [None] 这个时候不要着急,赶紧把科学上网打开。同时它不会影响comfyUI的运行. 4.comfyUI的使用
下面是正常启动的界面,所有节点都正常的加载. 如果安装失败,会显示IMPORT FAILED 如图:
5. 模型文件找不到
模型文件分为很多类别,一类是和sd相关的checkpoint, Lora, embedding这,常见的是你拉过来别的workflow,作者命名这些文件有自己的习惯,拿过来需要确认和自己本地保存的文件名字一致。 一类是custom node自己需要的模型文件,第一次运行时会在相应的网站,一般就是github,huggingface这类,国内也有modelscope这类。 a. checkpoint,lora名字不一致 是一种常见的错误,把别人的workflow加载进来时,记得要看model名字和自己本地的是否一样 File "C:\DEV\ComfyUI_windows_portable\ComfyUI\execution.py", line 153, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "C:\DEV\ComfyUI_windows_portable\ComfyUI\execution.py", line 83, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "C:\DEV\ComfyUI_windows_portable\ComfyUI\execution.py", line 76, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) File "C:\DEV\ComfyUI_windows_portable\ComfyUI\nodes.py", line 476, in load_checkpoint out = comfy.sd.load_checkpoint_guess_config(ckpt_path, output_vae=True, output_clip=True, embedding_directory=folder_paths.get_folder_paths("embeddings")) File "C:\DEV\ComfyUI_windows_portable\ComfyUI\comfy\sd.py", line 400, in load_checkpoint_guess_config sd = comfy.utils.load_torch_file(ckpt_path) File "C:\DEV\ComfyUI_windows_portable\ComfyUI\comfy\utils.py", line 12, in load_torch_file if ckpt.lower().endswith(".safetensors"): AttributeError: 'NoneType' object has no attribute 'lower' b.无法连接hugging face 关键字 huggingface.co "Connection to huggingface.co timed out" 这类. '(MaxRetryError("HTTPSConnectionPool(host='Hugging Face – The AI community building the future.', port=443): Max retries exceeded with url: /lllyasviel/Annotators/resolve/main/ZoeD_M12_N.pt (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001D934781DB0>, 'Connection to Hugging Face – The AI community building the future. timed out. (connect timeout=10)'))"), '(Request ID: dc2a2763-47a3-4862-b320-9aacf3a28b19)')' thrown while requesting HEAD https://huggingface.co/lllyasviel/Annotators/resolve/main/ZoeD_M12_N.pt WARNING:huggingface_hub.utils._http:'(MaxRetryError("HTTPSConnectionPool(host='Hugging Face – The AI community building the future.', port=443): Max retries exceeded with url: /lllyasviel/Annotators/resolve/main/ZoeD_M12_N.pt (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001D934781DB0>, 'Connection to Hugging Face – The AI community building the future. timed out. (connect timeout=10)'))"), '(Request ID: dc2a2763-47a3-4862-b320-9aacf3a28b19)')' thrown while requesting HEAD https://huggingface.co/lllyasviel/Annotators/resolve/main/ZoeD_M12_N.pt