matrix-org / matrix-hookshot

A bridge between Matrix and multiple project management services, such as GitHub, GitLab and JIRA.
https://matrix-org.github.io/matrix-hookshot/
Apache License 2.0
283 stars 68 forks source link

Error: Cannot find module '@matrix-org/matrix-sdk-crypto-nodejs-linux-x64-gnu' #884

Closed aman207 closed 8 months ago

aman207 commented 8 months ago

Hello, I'm trying to run hookshot locally on Rockylinux 9 but I'm running into this error when trying to start it. The build completes successfully. I'm wondering if I'm just missing a dependency? Not sure where to start since the build output really doesn't give me much info. Any information to get me started with troubleshooting would be appreciated.

> /usr/bin/node /opt/hookshot/lib/App/BridgeApp.js /opt/hookshot/config.yml /opt/hookshot/registration.yml
/opt/hookshot/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/index.js:250
    throw loadError
    ^

Error: Cannot find module '@matrix-org/matrix-sdk-crypto-nodejs-linux-x64-gnu'
Require stack:
- /opt/hookshot/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/index.js
- /opt/hookshot/node_modules/matrix-bot-sdk/lib/e2ee/CryptoClient.js
- /opt/hookshot/node_modules/matrix-bot-sdk/lib/index.js
- /opt/hookshot/lib/config/Config.js
- /opt/hookshot/lib/BotCommands.js
- /opt/hookshot/lib/AdminRoom.js
- /opt/hookshot/lib/Bridge.js
- /opt/hookshot/lib/App/BridgeApp.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
    at Module._load (node:internal/modules/cjs/loader:901:27)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/opt/hookshot/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/index.js:190:31)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/opt/hookshot/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/index.js',
    '/opt/hookshot/node_modules/matrix-bot-sdk/lib/e2ee/CryptoClient.js',
    '/opt/hookshot/node_modules/matrix-bot-sdk/lib/index.js',
    '/opt/hookshot/lib/config/Config.js',
    '/opt/hookshot/lib/BotCommands.js',
    '/opt/hookshot/lib/AdminRoom.js',
    '/opt/hookshot/lib/Bridge.js',
    '/opt/hookshot/lib/App/BridgeApp.js'
  ]
}

Node.js v20.9.0
aman207 commented 8 months ago

Looks like the binary matrix-sdk-crypto.linux-x64-gnu.node was missing from ./node_modules/matrix-appservice-bridge/node_modules/@matrix-org/matrix-sdk-crypto-nodejs and ./node_modules/@matrix-org/matrix-sdk-crypto-nodejs. Manually running npm install under these directories downloads the binary and resolves the runtime error. I don't understand why that isn't being done as part of the build process however?

aman207 commented 8 months ago

This is just an issue on my end. After removing the node_modules directory and rerunning yarn, it runs perfectly fine

Hope this'll at least help someone in the future!

Half-Shot commented 8 months ago

Very strange. I wonder if this was a transient issue with building the native library and it didn't fail the whole process like it should. Anyway, glad it's resolved and thank you for documenting.