debian&ubuntu 搭建云崽机器人

1.搭建环境(root用户下)

安装 curl

apt-get install -y curl

安装 git

apt-get install -y git

安装 redis

apt-get install -y redis

安装 nodejs(GitHub维护的脚本)

这里选用Node.js LTS (v22.x):

Ubuntu系统执行

curl -fsSL https://deb.nodesource.com/setup_lts.x -o nodesource_setup.sh

sudo -E bash nodesource_setup.sh

sudo apt-get install -y nodejs

验证版本

node -v

Debian系统(root用户)执行

curl -fsSL https://deb.nodesource.com/setup_lts.x -o nodesource_setup.sh

bash nodesource_setup.sh

apt-get install -y nodejs

验证版本

node -v

卸载 nodejs Ubuntu 和 Debian 软件包

要完全删除从上面的 deb.nodesource.com 包中安装的 Node.js:

sudo 在 Ubuntu 上使用或在 debian 上以 root 身份运行

apt-get purge nodejs &&\
rm -r /etc/apt/sources.list.d/nodesource.list &&\
rm -r /etc/apt/keyrings/nodesource.gpg

安装字体(防止汉字乱码 二选一)

apt install -y ttf-wqy-zenhei
apt install -y fonts-wqy-microhei

安装 screen 命令

apt install -y screen

2.克隆项目

推荐:喵版 Yunzai

1.克隆项目并安装miao-plugin

请根据网络情况选择Github安装或Gitee安装

# 使用 Github 
git clone --depth=1 https://github.com/yoimiya-kokomi/Miao-Yunzai.git
cd Miao-Yunzai 
git clone --depth=1 https://github.com/yoimiya-kokomi/miao-plugin.git ./plugins/miao-plugin/


# 使用Gitee
git clone --depth=1 https://gitee.com/yoimiya-kokomi/Miao-Yunzai.git
cd Miao-Yunzai 
git clone --depth=1 https://gitee.com/yoimiya-kokomi/miao-plugin.git ./plugins/miao-plugin/

2.安装pnpm ,已安装的可以跳过

# 使用npmjs.org安装
npm install pnpm -g

# 指定国内源npmmirror.com安装
npm --registry=https://registry.npmmirror.com install pnpm -g

3.安装依赖

# 直接安装
pnpm install -P

# 如依赖安装缓慢或失败,可尝试更换国内npm源后再执行install命令
pnpm config set registry https://registry.npmmirror.com
pnpm install -P

4.运行(首次运行按提示输入登录)

node app

常见问题

puppeteer 相关问题

    puppeteer Chromium 启动中...
    Error: Failed to launch the browser process!

遇到浏览器启动报错可以尝试下面的解决方法

方法一:Yunzai目录里执行

pnpm add puppeteer@13.7.0 -w

方法二:Yunzai目录里先执行

pnpm install puppeteer@19.7.3 -w

再执行

node ./node_modules/puppeteer/install.js

等待进度条走完,再重启机器人就可以了

方法三:Yunzai目录里执行下列命令 记得复制完,很长

apt-get install ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils libxkbcommon0 -y

api签名问题

推荐去https://qsign.icu/查看

Q.E.D.