zhuangxujie 01bc837fd4
Some checks failed
Server (Postgres) / Build & reinstall (setup) (push) Has been cancelled
Server (Postgres) / Python Unit Tests (1) (push) Has been cancelled
Server (Postgres) / Python Unit Tests (2) (push) Has been cancelled
Server (Postgres) / Python Unit Tests (3) (push) Has been cancelled
Server (Postgres) / Python Unit Tests (4) (push) Has been cancelled
Server (Mariadb) / Build & reinstall (setup) (push) Has been cancelled
Server (Mariadb) / Python Unit Tests (1) (push) Has been cancelled
Server (Mariadb) / Python Unit Tests (2) (push) Has been cancelled
Server (Mariadb) / Python Unit Tests (3) (push) Has been cancelled
Server (Mariadb) / Python Unit Tests (4) (push) Has been cancelled
Server (Mariadb) / Coverage Wrap Up (push) Has been cancelled
Lock threads / lock (push) Has been cancelled
Regenerate POT file (translatable strings) / Regenerate POT file (develop) (push) Has been cancelled
Regenerate POT file (translatable strings) / Regenerate POT file (version-16-hotfix) (push) Has been cancelled
Sync translations to hotfix branches / Trigger sync → version-16-hotfix (push) Has been cancelled
Create weekly release pull requests / Release (15) (push) Has been cancelled
Create weekly release pull requests / Release (16) (push) Has been cancelled
first commit
2026-07-23 16:31:28 +08:00

3.3 KiB
Raw Blame History

2026-07-21 ERPNext 本地部署

任务

用户要求把 /Users/boyang/Desktop/erpnext-develop 在本地部署为开发环境(ERPNext + banking 前端)。

项目架构发现

  • erpnext/ 是 Frappe 17 框架的 ERP 应用(Python,要求 >=3.14)
  • banking/ 是 ERPNext 内的 React 19 + Vite SPA 子应用,挂在 /banking 路由
    • 开发时 yarn dev 起 vite(端口 8080),通过 proxyOptions.ts 把 /app|api|assets|files|private 转发到 Frappe webserver
    • proxyOptions.ts 依赖相对路径 ../../../sites/common_site_config.json,意味着 banking 必须在 bench/apps/erpnext/banking/ 下
    • 构建产物输出到 ../erpnext/public/banking/,index.html 复制到 ../erpnext/www/banking.html
  • pyproject.toml 里 [tool.bench.assets] 配置 build_dir="./banking" out_dir="../erpnext/public/banking"

已完成步骤

  1. Homebrew:之前装到一半失败(git remote 指向 GitHub 直连,clone 超时)。改用中科大镜像 https://mirrors.ustc.edu.cn/brew.git 拉取并 reset --hard,brew 命令恢复可用。
  2. brew 镜像配置:写入 ~/.zshrc,HOMEBREW_API_DOMAIN/BOTTLE_DOMAIN 用清华源,BREW_GIT_REMOTE/CORE_GIT_REMOTE 用中科大源。
  3. brew install:mariadb 12.3.2、redis 8.8.0、python@3.14(3.14.6)、yarn 1.22.22。wkhtmltopdf 在新版 Homebrew 没有 formula,需后续用 --cask 单独装(非必须,只影响 PDF 报表)。
  4. MariaDB 端口冲突:用户机器上已有两个 MySQL 8.0.28 在跑(ks-inventory-system-master 占 3306,caigouxitong/ks-inventory-system 占 3307)。不能 kill 它们。
  5. MariaDB 配置:写 /opt/homebrew/etc/my.cnf.d/custom.cnf,用 3308 端口 + socket /tmp/mysql_bench.sock,bind 127.0.0.1,utf8mb4 字符集,innodb_file_per_table + DYNAMIC row format。
  6. MariaDB root 密码:用 skip-grant-tables + skip-networking 临时绕过认证(sudo 需密码无法用),设 root 密码为 root,认证插件改为 mysql_native_password,然后移除 skip 配置重启。
  7. brew services:mariadb + redis 都已 brew services start(开机自启)。
  8. bench CLI:用 Python 3.14 创建独立 venv /Users/boyang/.frappe-bench-venv,pip install frappe-bench 5.31.0(清华 PyPI 镜像),符号链接到 /opt/homebrew/bin/bench。

进行中

  1. bench init:bench init --frappe-branch version-17 --python /opt/homebrew/bin/python3.14 frappe-bench,在 ~/frappe-bench 创建。GitHub 直连慢(国内镜像 ghproxy/fastgit/kgithub 全挂),靠 --depth 1 浅克隆 + 清华 pip + 淘宝 npm 加速。

待办

  1. bench get-app /Users/boyang/Desktop/erpnext-develop 链接本地 erpnext 仓库
  2. bench build 编译 banking 前端
  3. bench new-site erpnext.localhost(要指定 db_port=3308, db_root_password=root)
  4. bench --site erpnext.localhost install-app erpnext
  5. bench start 启动,访问 http://erpnext.localhost:8000

关键参数备忘

  • MariaDB:127.0.0.1:3308,root/root,socket /tmp/mysql_bench.sock
  • bench venv:/Users/boyang/.frappe-bench-venv
  • bench 工作目录:/Users/boyang/frappe-bench
  • erpnext 源码:/Users/boyang/Desktop/erpnext-develop(含 erpnext/ 和 banking/)
  • Python:/opt/homebrew/bin/python3.14(3.14.6)