Yunzai配置外置渲染

Yunzai配置外置渲染
重装小兔该方法由R插件群流出,用于解决因yunzai渲染和其他一些情况下导致的内存泄露问题
R插件群:575663150
教程使用Ubuntu演示
第一步:
安装npm和PM2
plaintext
1 | curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - |
plaintext
1 | sudo apt install -y nodejs |
plaintext
1 | npm install -g pm2 |
第二步:
新建文件夹
plaintext
1 | mkdir myproject |
plaintext
1 | cd myproject |
第三步:
初始化
plaintext
1 | npm install -g pnpm |
plaintext
1 | pnpm init |
第四步:
下载配置文件放入文件夹
点击一键跳转下载
第五步
安装依赖
plaintext
1 | pnpm install @karinjs/puppeteer node-fetch |
安装浏览器
plaintext
1 | apt install -y chromium-browser |
第六步:
启动项目
plaintext
1 | node . |
然后CTRL+C退出
第七步:
添加render-base64.js到yunzai目录下的plugins/example
第八步:
使用 PM2 启动 Puppeteer 服务
plaintext
1 | pm2 start pm2.json |
第八步:
查看 PM2 进程状态
plaintext
1 | pm2 status |
第九步
查看日志,确认运行情况
plaintext
1 | pm2 logs karin-puppeteer |
第十步
配置PM2开机自启+后台运行
plaintext
1 | pm2 startup |
plaintext
1 | pm2 save |
验证配置:
plaintext
1 | systemctl is-enabled pm2-root |
- 如果输出是
enabled,说明 PM2 已成功配置为开机自启。
第十一步:
查看myproject/config.json确认配置,然后修改render-base64.js
修改render-base64.js
找不到群里render-base64.js的直接复制我这个修改好的
plaintext
1 | /* |
修改处:
plaintext
1 | const host = |
plaintext
1 | const authorization = |
确保端口和秘钥正确
附加功能:
出现图片异常(乱码)那是因为你服务器没安装中文语言环境,导致渲染不了中文字体
自行百度安装,然后重启服务器即可
Ubuntu举例:
plaintext
1 | sudo apt install language-pack-zh-hans language-pack-gnome-zh-hans |
plaintext
1 | sudo nano /etc/default/locale |
plaintext
1 | LANG="zh_CN.UTF-8" |
按CTRL+X
然后回车
plaintext
1 | sudo locale-gen zh_CN.UTF-8 |
plaintext
1 | sudo locale-gen zh_CN |
plaintext
1 | sudo dpkg-reconfigure locales |









