Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected token #26

Closed
hooger opened this issue Feb 27, 2019 · 6 comments
Closed

Unexpected token #26

hooger opened this issue Feb 27, 2019 · 6 comments

Comments

@hooger
Copy link

hooger commented Feb 27, 2019

Hello,

I try to register the service but does not really work. Here is the problem:

>> node index.js -r -u "http://localhost:8090"                                           
Unable to load crypto module: crypto will be disabled: Error: global.Olm is not defined
Unable to load crypto module: crypto will be disabled: Error: global.Olm is not defined
/usr/local/src/matrix-puppet-hangouts/client.js:29
      } catch {
              ^

SyntaxError: Unexpected token {
    at new Script (vm.js:51:7)
    at createScript (vm.js:136:10)
    at Object.runInThisContext (vm.js:197:10)
    at Module._compile (internal/modules/cjs/loader.js:618:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Module.require (internal/modules/cjs/loader.js:598:17)
    at require (internal/modules/cjs/helpers.js:11:18)
    at Object.<anonymous> (/usr/local/src/matrix-puppet-hangouts/index.js:8:24)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
    at startup (internal/bootstrap/node.js:201:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)

User is the same as the one I generated the token with and for. python3 hangups_client.py --login-and-save-token didn't worked, but I used OAuth, and I think it is okay, as hangups --manual loads and shows my contacts. ~/.cache/hangups/refresh_token.txt has a 45 letter long token with no trailing new line.

Do you have any idea what the problem can be? System is Debian 9, up-to-date. matrix-puppet-facebook works.
Thank you for your help in advance!

@ericmigi
Copy link

ericmigi commented Mar 4, 2019

same issue on ubuntu 18.04, fresh install when trying to generate hangouts-registration.yaml file with node index.js -r -u "http://127.0.0.1:8090"

@thomas-profitt
Copy link
Member

@hooger @ericmigi , would you both run node --version? This could be caused by an old node version (node 10 is known to work, we expect node 8 does too, but no earlier version, and node is packaged strangely on Debian-based distributions by default)

@ericmigi
Copy link

ericmigi commented Mar 7, 2019

root@matrix-synapse:~# node -v
v8.10.0

@thomas-profitt
Copy link
Member

@hooger @ericmigi Would you pull the latest master, which includes that commit up there, and test again?

I was able to reproduce this on node 8, using the REPL in Docker's official node 8 image:

> docker run -i -t --rm node:8-alpine node

> try {
...   var data = JSON.parse(str);
...   debugVerbose("emitting message", data);
...   this.emit('message', data);
... } catch {
} catch {
        ^

SyntaxError: Unexpected token {

>

I've gathered that, while try { } catch { } works in node 10 and node 11, try { } catch(error) { } is required in node 8, so I've added the parameter to appease it.

@thomas-profitt
Copy link
Member

(Heard that this was working outside my REPL, woo!)

@hooger
Copy link
Author

hooger commented Mar 7, 2019

My node is 9.x and it works for me as well.
Thank you for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants