frappe 网络问题导致初始化失败
frappe 以docker的方式部署开发环境教程如下:
frappe_docker/development at main · frappe/frappe_docker · GitHub
1.clone或者下载文件自己上传到服务器然后解压
git clone https://github.com/frappe/frappe_docker.git
cd frappe_docker
2.将样例文件复制到目标文件夹
cp -R devcontainer-example .devcontainer
3.因为之后编辑需要用vscode,所以把这个也复制一下
cp -R development/vscode-example development/.vscode
4.在frappe_docker 目录下执行命令启动服务
docker-compose -f .devcontainer/docker-compose.yml up -d
5.进入容器
docker exec -e "TERM=xterm-256color" -w /workspace/development -it devcontainer-frappe-1 bash
我的服务是运行在天翼云上的,由于国际网络问题导致初始化不能成功
6.其中有一个问题是github访问不正常导致的,这里参考下面的方法,修改一下指向的ip
国内服务器无法访问Github导致git pull失效的解决办法 - 冰沫记 (iymark.com)
vi /etc/hosts
如果提示没有权限,就加上sudo
sudo vi /etc/hosts
然后里面输入
15.164.81.167 github.com
15.164.81.167 www.github.com
按esc,输入wq!
保存后,测试ping,如果很顺畅就可以了
ping github.com
7.执行安装的时候,还需要pip,所以把pip的源也换了
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
8. 然后执行初始化,就可以成功了
bench init --skip-redis-config-generation --frappe-branch version-13 frappe-bench
执行日志如下
frappe@28d567d3ad98:/workspace/development$ bench init --skip-redis-config-generation --frappe-branch version-13 frappe-bench
$ /home/frappe/.local/bin/virtualenv --quiet env -p python3
$ /workspace/development/frappe-bench/env/bin/python -m pip install --quiet --upgrade pip
Getting frappe
$ git clone https://github.com/frappe/frappe.git --branch version-13 --depth 1 --origin upstream
Cloning into 'frappe'...
remote: Enumerating objects: 2993, done.
remote: Counting objects: 100% (2993/2993), done.
remote: Compressing objects: 100% (2679/2679), done.
Receiving objects: 64% (1920/2993), 1.89 MiB | 11.00 KiB/s
Receiving objects: 64% (1920/2993), 2.02 MiB | 19.00 KiB/s
Receiving objects: 64% (1922/2993), 2.20 MiB | 31.00 KiB/s
^Cceiving objects: 64% (1925/2993), 2.57 MiB | 26.00 KiB/s
Aborted!
frappe@28d567d3ad98:/workspace/development$ rm -rf frappe-bench/
frappe@28d567d3ad98:/workspace/development$ bench init --skip-redis-config-generation --frappe-branch version-13 frappe-bench
$ /home/frappe/.local/bin/virtualenv --quiet env -p python3
$ /workspace/development/frappe-bench/env/bin/python -m pip install --quiet --upgrade pip
Getting frappe
$ git clone https://github.com/frappe/frappe.git --branch version-13 --depth 1 --origin upstream
Cloning into 'frappe'...
remote: Enumerating objects: 2993, done.
remote: Counting objects: 100% (2993/2993), done.
remote: Compressing objects: 100% (2674/2674), done.
remote: Total 2993 (delta 435), reused 1143 (delta 247), pack-reused 0
Receiving objects: 100% (2993/2993), 16.35 MiB | 9.39 MiB/s, done.
Resolving deltas: 100% (435/435), done.
Installing frappe
$ /workspace/development/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /workspace/development/frappe-bench/apps/frappe
$ yarn install
yarn install v1.22.17
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > bootstrap@4.5.0" has unmet peer dependency "popper.js@^1.16.0".
warning Workspaces can only be enabled in private projects.
[4/4] Building fresh packages...
warning Your current version of Yarn is out of date. The latest version is "1.22.19", while you're on "1.22.17".
info To upgrade, run the following command:
$ curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
$ yarn run snyk-protect
yarn run v1.22.17
$ snyk protect
Successfully applied Snyk patches
Done in 17.12s.
Done in 451.34s.
$ bench build
Retrieving assets...
('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
✔ Application Assets Linked s
yarn run v1.22.17
$ FRAPPE_ENV=production node rollup/build.js
Production mode
✔ Built js/moment-bundle.min.js
✔ Built js/libs.min.js
Building frappe assets...
✔ Built js/checkout.min.js
✔ Built js/dialog.min.js
✔ Built js/web_form.min.js
✔ Built js/user_profile_controller.min.js
✔ Built js/list.min.js
✔ Built js/bootstrap-4-web.min.js
✔ Built js/barcode_scanner.min.js
✔ Built js/frappe-recorder.min.js
✔ Built js/frappe-web.min.js
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade caniuse-lite browserslist`
✔ Built css/report.min.css
✔ Built css-rtl/report.min.css
✔ Built js/data_import_tools.min.js
✔ Built js/report.min.js
✔ Built css/web_form.css
✔ Built css-rtl/web_form.css
✔ Built css/printview.css
✔ Built css/email.css
✔ Built css/login.css
✔ Built js/control.min.js
✔ Built js/desk.min.js
✔ Built css/frappe-web-b4.css
✔ Built css/desk.min.css
✔ Built css-rtl/printview.css
✔ Built css-rtl/email.css
✔ Built css-rtl/login.css
✔ Built css-rtl/frappe-web-b4.css
✔ Built css-rtl/desk.min.css
✔ Built js/form.min.js
✨ Done in 112.761s
Done in 115.33s.
SUCCESS: Bench frappe-bench initialized