mayudev / revcord

A bridge for Discord and Revolt with easy setup through commands
MIT License
64 stars 9 forks source link

sqlite3 and TypeError errors #15

Closed Sienna7002 closed 1 year ago

Sienna7002 commented 1 year ago

This is what happens when I attempt to start on my Raspberry Pi 3B

revcord@1.1.1 start node build/index.js

ERR! db A database error occurred. If you don't know what to do, try removing the revcord.sqlite file (will reset all your settings). ERR! db Error: Please install sqlite3 package manually ERR! db at ConnectionManager._loadDialectModule (/home/s7002/revcord/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:55:15) ERR! db at new ConnectionManager (/home/s7002/revcord/node_modules/sequelize/lib/dialects/sqlite/connection-manager.js:18:21) ERR! db at new SqliteDialect (/home/s7002/revcord/node_modules/sequelize/lib/dialects/sqlite/index.js:13:30) ERR! db at new Sequelize (/home/s7002/revcord/node_modules/sequelize/lib/sequelize.js:194:20) ERR! db at Main. (/home/s7002/revcord/build/app/Main.js:39:31) ERR! db at Generator.next () ERR! db at /home/s7002/revcord/build/app/Main.js:8:71 ERR! db at new Promise () ERR! db at awaiter (/home/s7002/revcord/build/app/Main.js:4:12) ERR! db at Main.initDb (/home/s7002/revcord/build/app/Main.js:38:16) ERR! db Error: Please install sqlite3 package manually ERR! db at ConnectionManager._loadDialectModule (/home/s7002/revcord/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:55:15) ERR! db at new ConnectionManager (/home/s7002/revcord/node_modules/sequelize/lib/dialects/sqlite/connection-manager.js:18:21) ERR! db at new SqliteDialect (/home/s7002/revcord/node_modules/sequelize/lib/dialects/sqlite/index.js:13:30) ERR! db at new Sequelize (/home/s7002/revcord/node_modules/sequelize/lib/sequelize.js:194:20) ERR! db at Main. (/home/s7002/revcord/build/app/Main.js:39:31) ERR! db at Generator.next () ERR! db at /home/s7002/revcord/build/app/Main.js:8:71 ERR! db at new Promise () ERR! db at __awaiter (/home/s7002/revcord/build/app/Main.js:4:12) ERR! db at Main.initDb (/home/s7002/revcord/build/app/Main.js:38:16) info Revolt Logged in as Disvolt TypeError: Cannot read properties of undefined (reading 'forEach') at Client. (/home/s7002/revcord/build/app/Bot.js:148:34) at Client.emit (/home/s7002/revcord/node_modules/eventemitter3/index.js:180:35) at WebSocketClient. (/home/s7002/revcord/node_modules/revolt.js/dist/websocket/client.js:137:41) at Generator.next () at /home/s7002/revcord/node_modules/revolt.js/dist/websocket/client.js:8:71 at new Promise () at awaiter (/home/s7002/revcord/node_modules/revolt.js/dist/websocket/client.js:4:12) at process (/home/s7002/revcord/node_modules/revolt.js/dist/websocket/client.js:95:41) at WebSocketClient. (/home/s7002/revcord/node_modules/revolt.js/dist/websocket/client.js:538:23) at Generator.next () info Discord Logged in as DisVolt#2900 /home/s7002/revcord/build/app/Bot.js:70 Main_1.Main.mappings.forEach((mapping) => __awaiter(this, void 0, void 0, function* () { ^

TypeError: Cannot read properties of undefined (reading 'forEach') at Client. (/home/s7002/revcord/build/app/Bot.js:70:34) at Object.onceWrapper (node:events:628:26) at Client.emit (node:events:513:28) at WebSocketManager.triggerClientReady (/home/s7002/revcord/node_modules/discord.js/src/client/websocket/WebSocketManager.js:387:17) at WebSocketManager.checkShardsReady (/home/s7002/revcord/node_modules/discord.js/src/client/websocket/WebSocketManager.js:370:10) at WebSocketShard. (/home/s7002/revcord/node_modules/discord.js/src/client/websocket/WebSocketManager.js:200:16) at WebSocketShard.emit (node:events:513:28) at WebSocketShard.checkReady (/home/s7002/revcord/node_modules/discord.js/src/client/websocket/WebSocketShard.js:181:12) at WebSocketShard.gotGuild (/home/s7002/revcord/node_modules/discord.js/src/client/websocket/WebSocketShard.js:155:10) at WebSocketManager. (/home/s7002/revcord/node_modules/discord.js/src/client/websocket/WebSocketManager.js:240:15)

Node.js v18.16.1

mayudev commented 1 year ago

This is most likely caused by the sqlite3 native module missing. It should fetch the prebuilt version but sometimes it fails and I don't really know why. I'd suggest you do npm rebuild and then if it's stuck you can open htop in another terminal and see if gcc is running. If yes, then it's attempting to build the native module and it's nearly impossible to do that on a rpi lol So a hacky solution for now would be to find prebuilt sqlite3 binaries for arm (you can find them in their github releases), it can be for a newer version as long as its the same major release. Then put them in (iirc) node_modules/sqlite3/bin(?)/Release I'll try to reproduce the issue on my own and find a proper solution when I'm back home.

Sienna7002 commented 1 year ago

Thank you, I will try this later

Sienna7002 commented 1 year ago

I tried the second method you told me to do, i went into the sqlite3 folder but there is no bin folder in there, what do i do?

mayudev commented 1 year ago

This is an issue specific to 32-bit arm distros running on Raspberry Pi and similar devices

I have explained how to fix this issue here.