witchent / matrix-puppet-signal

A Signal bridge for Matrix
35 stars 2 forks source link

Errors while running 'npm run link' #3

Closed upgradetofreedom closed 4 years ago

upgradetofreedom commented 4 years ago

I tried to install matrix-puppet-signal on my Debian 10 Server. I followed the steps exactly. Until npm run link everything works well.

Terminal output when I run npm run link

 matrix-puppet-signal@2.0.0 link /home/user/matrix-puppet-signal
> node -e "new (require('signal-client'))('matrix').link()"

internal/modules/cjs/loader.js:797
    throw err;
    ^

Error: Cannot find module '../../ts/util/makeLookup'
Require stack:
- /home/user/matrix-puppet-signal/node_modules/signal-desktop/js/modules/stickers.js
- /home/user/matrix-puppet-signal/node_modules/signal-desktop/js/modules/web_api.js
- /home/user/matrix-puppet-signal/node_modules/signal-client/index.js
- /home/user/matrix-puppet-signal/[eval]
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/user/matrix-puppet-signal/node_modules/signal-desktop/js/modules/stickers.js:35:24)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/user/matrix-puppet-signal/node_modules/signal-desktop/js/modules/web_api.js:7:26)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/user/matrix-puppet-signal/node_modules/signal-desktop/js/modules/stickers.js',
    '/home/user/matrix-puppet-signal/node_modules/signal-desktop/js/modules/web_api.js',
    '/home/user/matrix-puppet-signal/node_modules/signal-client/index.js',
    '/home/user/matrix-puppet-signal/[eval]'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! matrix-puppet-signal@2.0.0 link: `node -e "new (require('signal-client'))('matrix').link()"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the matrix-puppet-signal@2.0.0 link script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
witchent commented 4 years ago

Your npm install threw no errors? Can you look into matrix-puppet-signal/node_modules/signal-desktop/ts/util if there is a makeLookup.js or just a makeLookup.ts? If it is the latter (so no .js file) please cd into matrix-puppet-signal/node_modules/signal-desktop and run yarn && yarn grunt and see if that changes anything (this should happen automatically with npm install, but maybe something went wrong).

upgradetofreedom commented 4 years ago
error /home/user/matrix-puppet-signal/node_modules/signal-desktop/node_modules/electron-chromedriver: Command failed.
Exit code: 1
Command: node ./download-chromedriver.js
Arguments: 
Directory: /home/user/matrix-puppet-signal/node_modules/signal-desktop/node_modules/electron-chromedriver
Output:
/home/user/matrix-puppet-signal/node_modules/signal-desktop/node_modules/electron-chromedriver/download-chromedriver.js:19
  if (err != null) throw err
                   ^

Error: GET https://github.com/electron/electron/releases/download/v8.0.0/chromedriver-v8.0.0-linux-x64.zip returned 403
    at Request.<anonymous> (/home/user/matrix-puppet-signal/node_modules/signal-desktop/node_modules/nugget/index.js:169:61)
    at Request.emit (events.js:210:5)
    at Request.onRequestResponse (/home/user/matrix-puppet-signal/node_modules/signal-desktop/node_modules/request/request.js:1059:10)
    at ClientRequest.emit (events.js:210:5)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:583:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:115:17)
    at TLSSocket.socketOnData (_http_client.js:456:22)

Nevertheless I tried 'npm run link' again:

> matrix-puppet-signal@2.0.0 link /home/user/matrix-puppet-signal
> node -e "new (require('signal-client'))('matrix').link()"

/home/user/matrix-puppet-signal/node_modules/signal-desktop/node_modules/electron/index.js:14
    throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again')
    ^

Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
    at getElectronPath (/home/user/matrix-puppet-signal/node_modules/signal-desktop/node_modules/electron/index.js:14:11)
    at Object.<anonymous> (/home/user/matrix-puppet-signal/node_modules/signal-desktop/node_modules/electron/index.js:18:18)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/user/matrix-puppet-signal/node_modules/signal-desktop/app/attachments.js:3:40)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at signalRequire (/home/user/matrix-puppet-signal/node_modules/signal-client/index.js:17:35)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! matrix-puppet-signal@2.0.0 link: `node -e "new (require('signal-client'))('matrix').link()"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the matrix-puppet-signal@2.0.0 link script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
witchent commented 4 years ago

Okay this is really weird, you are getting some access denied on this file: https://github.com/electron/electron/releases/download/v8.0.0/chromedriver-v8.0.0-linux-x64.zip

Can you try to manually download it (with the same machine you're trying to build the bridge on, via wget) and see if that works? If it does, can you give me your output of "yarn -v", "node -v" and "npm -v"? Also, are you using any sandbox/firewalling that might prevent yarn from downloading files?

Also, I am guessing the error happens with yarn, not yarn grunt, but can you confirm that?

If everything above does not work, you can also clone into another folder and instead of "npm install" run "npm install --production" and see where that gets you. Though I don't think this will solve the problem.

And one last idea for today: could you try to clone and install the official signal-app and see if that compiles and you can run it? From here: https://github.com/signalapp/Signal-Desktop/tree/master (Make sure you use the master branch)

upgradetofreedom commented 4 years ago

Thanks. Now I got 'npm run link' working... Now when I start the bridge I get this error:

Possibly Unhandled Rejection at: Promise  Promise {
  <rejected> [M_UNKNOWN_TOKEN: Invalid macaroon passed.] {
    errcode: 'M_UNKNOWN_TOKEN',
    name: 'M_UNKNOWN_TOKEN',
    message: 'Invalid macaroon passed.',
    data: {
      errcode: 'M_UNKNOWN_TOKEN',
      error: 'Invalid macaroon passed.',
      soft_logout: false
    },
    httpStatus: 401
  }
}  reason:  [M_UNKNOWN_TOKEN: Invalid macaroon passed.] {
  errcode: 'M_UNKNOWN_TOKEN',
  name: 'M_UNKNOWN_TOKEN',
  message: 'Invalid macaroon passed.',
  data: {
    errcode: 'M_UNKNOWN_TOKEN',
    error: 'Invalid macaroon passed.',
    soft_logout: false
  },
  httpStatus: 401
}
Possibly Unhandled Rejection at: Promise  Promise {
  <rejected> [M_UNKNOWN_TOKEN: Invalid macaroon passed.] {
    errcode: 'M_UNKNOWN_TOKEN',
    name: 'M_UNKNOWN_TOKEN',
    message: 'Invalid macaroon passed.',
    data: {
      errcode: 'M_UNKNOWN_TOKEN',
      error: 'Invalid macaroon passed.',
      soft_logout: false
    },
    httpStatus: 401
  }
}  reason:  [M_UNKNOWN_TOKEN: Invalid macaroon passed.] {
  errcode: 'M_UNKNOWN_TOKEN',
  name: 'M_UNKNOWN_TOKEN',
  message: 'Invalid macaroon passed.',
  data: {
    errcode: 'M_UNKNOWN_TOKEN',
    error: 'Invalid macaroon passed.',
    soft_logout: false
  },
  httpStatus: 401
}
witchent commented 4 years ago

Before we continue, what was the problem/what did the trick of getting it to run?

For your new problem, this means that the server does not accept your access token. Did you by chance use npm link twice successfully (i.e. logging in to your homeserver) or did you delete the bridge device from your devices in riot? I don't think this is really related to the bridge, but I would suggest trying a clean install again (including deleting old devices from your account etc), otherwise I don't really have any ideas here.

meatballs commented 4 years ago

I had a very similar problem:

> matrix-puppet-signal@2.0.0 link /usr/src/matrix-puppet-signal
> node -e "new (require('signal-client'))('matrix').link()"

internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module 'electron'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/src/matrix-puppet-signal/node_modules/signal-desktop/app/attachments.js:3:40)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at signalRequire (/usr/src/matrix-puppet-signal/node_modules/signal-client/index.js:17:35)
    at Object.<anonymous> (/usr/src/matrix-puppet-signal/node_modules/signal-client/index.js:36:21)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

Having found this issue, I ran yarn from within the node_modules folder and that fixed the problem.

witchent commented 4 years ago

Well that is weird, but good to know it fixed it for you, thank you very much for your feedback :)

witchent commented 4 years ago

Closing this as it seems to be an install error