- tailwindcss generate failed after 5 seconds · tailwindlabs/tailwindcss · Discussion #16417
- github.com/cgohlke/pyi…
- github.com/infiniflow/…
ragflow的前后端又改版了,只能速速跟上,
已发现的改进(截至2025/3/13):
- 知识库配置中取消了语言选项
- 后端采用了类似热重载的方式(就是报错时无限启动的场景实在太美,还不好退出)
- 后端默认是在linux系统中启动,win系统启动非常麻烦,
前期准备
下载源码
git clone https://github.com/infiniflow/ragflow.git
cd ragflow
启动基础组件
mysql、minio、 es-search、 redis
docker compose -f docker/docker-compose-base.yml up -d
安装uv
在当前目录创建pip.ini文件
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
启动后端
安装依赖
修改project.toml,将fasttext修改成fasttext.wheel
uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules
不出意外,会报一个pyicu的错误,下载编译好的pyicu,
uv pip install 下载好的路径\PyICU-2.14-cp310-cp310-win_amd64.whl
重新执行uv sync --python 3.10 --all-extras 直至完全成功
执行代码
修改源码,确保sh脚本的python能准确识别路径。
api\ragflow_server.py:
# 新增代码
import sys
import os
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(root)
from api.utils.log_utils import initRootLogger
initRootLogger("ragflow_server")
rag\svr\task_executor.py:
# 新增代码
import sys
import os
root = os.path.dirname(os.path.dirname(
os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root)
import random
from api.utils.log_utils import initRootLogger, get_project_base_directory
在docker目录下新建 entrypoint2.sh文件
#!/bin/bash
# 动态生成虚拟环境路径(Git Bash/WSL 兼容)
PROJECT_ROOT=$(pwd)
PY="${PROJECT_ROOT}/.venv/Scripts/python.exe"
# 验证路径是否存在
if [ ! -f "$PY" ]; then
echo "错误:未找到 Python 解释器,请检查虚拟环境!"
exit 1
fi
echo "使用 Python 路径: $PY"
$PY --version # 验证 Python 版本
if [[ -z "$WS" || $WS -lt 1 ]]; then
WS=1
fi
# 运行任务
function task_exe(){
while true; do
$PY rag/svr/task_executor.py $1
done
}
for ((i=0;i<WS;i++))
do
task_exe $i &
done
while [ 1 -eq 1 ];do
$PY api/ragflow_server.py
done
控制台
.venv/Scripts/activate
bash docker/entrypoint2.sh
不出意外的话,会有一个ModuleNotFoundError: No module named 'resource' 错误,不过应该无伤大雅,
打开网址:http://localhost:9380/,出现:{"code":100,"data":null,"message":"<NotFound '404: Not Found'>"}说明后端启动成功
前端启动
cd web
npm install
npm run dev
然而很不幸,报错了
info - [你知道吗?] @umijs/max 是蚂蚁内网框架 Bigfish 的对外版本。
info - Umi v4.2.3
info - Preparing...
info - [icons] generate icons local:google, local:github
info - [plugin: ./node_modules/@umijs/plugins/dist/tailwindcss] tailwindcss service started
info - [icons] generate icons local:google, local:github
info - [icons] generate icons local:google, local:github
error - [plugin: ./node_modules/@umijs/plugins/dist/tailwindcss] tailwindcss generate failed after 5 seconds, please check your tailwind.css and tailwind.config.js
解决办法:
找到node_modules\@umijs\plugins\dist\tailwindcss.js文件,将CHECK_TIMEOUT_UNIT_SECOND 值改得长一点,例如35
module.exports = __toCommonJS(tailwindcss_exports);
var import_fs = require("fs");
var import_path = require("path");
var import_plugin_utils = require("umi/plugin-utils");
var CHECK_INTERVAL = 300;
var CHECK_TIMEOUT_UNIT_SECOND = 35;