按照教程 你们要的魔改小爱音箱的教程出来了 (qq.com) idootop/mi-gpt: 🏠 将小爱音箱接入 ChatGPT 和豆包,改造成你的专属语音助手。 (github.com)
安装nodejs
# https://nodejs.org/en/download/package-manager
# installs nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# download and install Node.js (you may need to restart the terminal)
nvm install 22
# verifies the right Node.js version is in the environment
node -v # should print `v22.4.0`
# verifies the right NPM version is in the environment
npm -v # should print `10.8.1`
# 以上方法无效,换下面
curl -sL https://deb.nodesource.com/setup_20.x | bash
apt-get install nodejs -y
node -v
cd /opt/mi-gpt
npm config set registry https://npm.aliyun.com
export PRISMA_ENGINES_MIRROR=https://registry.npmmirror.com/-/binary/prisma
npm install
很不容易,疯狂报错,先是1
root@localhost:/opt/mi-gpt# npm install
mi-gpt@4.1.0 postinstall npx -y prisma migrate dev --name hello
Downloading Prisma engines for Node-API for linux-arm64-openssl-1.1.x [ ] 0%Error: request to https://binaries.prisma.sh/all_commits/34ace0eb2704183d2c05b60b52fba5c43c13f303/linux-arm64-openssl-1.1.x/libquery_engine.so.node.sha256 failed, reason: npm error code 1 npm error path /opt/mi-gpt npm error command failed npm error command sh -c npx -y prisma migrate dev --name hello
npm error A complete log of this run can be found in: /root/.npm/_logs/2024-07-07T14_00_29_673Z-debug-0.log
解决:国内源 export 下载 PRISMA_ENGINES_MIRROR=https://registry.npmmirror.com/-/binary/prisma
报错2 初始化db不成功。最后手动创建app.db解决
root@localhost:/opt/mi-gpt# ls -l /opt/mi-gpt/prisma
total 11
drwxr-xr-x. 2 root root 3488 Jul 7 20:08 engines
drwxr-xr-x. 3 root root 3488 Jul 7 20:08 migrations
-rwxr-xr-x. 1 root root 3443 Jul 7 20:13 schema.prisma
root@localhost:/opt/mi-gpt# chown root:root /opt/mi-gpt/prisma/dev.db
chown: cannot access '/opt/mi-gpt/prisma/dev.db': No such file or directory
root@localhost:/opt/mi-gpt# chmod 600 /opt/mi-gpt/prisma/dev.db
chmod: cannot access '/opt/mi-gpt/prisma/dev.db': No such file or directory
root@localhost:/opt/mi-gpt# npx prisma migrate dev --name hello
Prisma schema loaded from prisma/schema.prisma
Datasource "db": SQLite database "app.db" at "file:app.db"Error: Schema engine error:
Failed to open SQLite database.
Operation not permitted (os error 1)root@localhost:/opt/mi-gpt# export PRISMA_ENGINES_MIRROR=https://registry.npmmirror.com/-/binary/prisma
root@localhost:/opt/mi-gpt# sudo npx prisma migrate dev --name hello
Prisma schema loaded from prisma/schema.prisma
Datasource "db": SQLite database "app.db" at "file:app.db"Error: Schema engine error:
Failed to open SQLite database.
Operation not permitted (os error 1)root@localhost:/opt/mi-gpt# # 更改文件和目录所有权为 root 用户和组
root@localhost:/opt/mi-gpt# sudo chown -R root:root /opt/mi-gpt
root@localhost:/opt/mi-gpt#
root@localhost:/opt/mi-gpt# # 设置目录权限为 755,文件权限为 644
root@localhost:/opt/mi-gpt# sudo chmod -R 755 /opt/mi-gpt/prisma
root@localhost:/opt/mi-gpt# sudo chmod 644 /opt/mi-gpt/prisma/app.db
chmod: cannot access '/opt/mi-gpt/prisma/app.db': No such file or directory
root@localhost:/opt/mi-gpt# sudo chmod 644 /opt/mi-gpt/prisma/app.db
root@localhost:/opt/mi-gpt# sudo npx prisma migrate dev --name hello
Prisma schema loaded from prisma/schema.prisma
Datasource "db": SQLite database "app.db" at "file:app.db"Applying migration `20240227161545_init`
The following migration(s) have been applied:
migrations/
└─ 20240227161545_init/
└─ migration.sqlYour database is now in sync with your schema.
✔ Generated Prisma Client (v5.16.1) to ./node_modules/@prisma/client in 1.82s
root@localhost:/opt/mi-gpt#
正式建build
npm run build
npm start
npm start