alexbosworth / ln-service

Node.js interface to LND
MIT License
319 stars 60 forks source link

Bug: const mtokensPerToken = 1000n: Invalid or unexpected token #97

Closed otech47 closed 5 years ago

otech47 commented 5 years ago

In version 41.0.1 when trying to require('ln-service') this error is thrown:

/Users/oscarlafarga/setlife-network/setblocks/node_modules/ln-service/lightning/get_invoices.js:19
const mtokensPerToken = 1000n;
                        ^^^^

SyntaxError: Invalid or unexpected token
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/oscarlafarga/setlife-network/setblocks/node_modules/ln-service/lightning/index.js:19:21)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/oscarlafarga/setlife-network/setblocks/node_modules/ln-service/index.js:1:81)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)

I suspect something related to inconsistent/conflicting NodeJS versions where I may not have some newer JS features but I have never seen the JS syntax of a n appended to an Int like it is at 1000n.

otech47 commented 5 years ago

Note that reverting the package to ^34.7.2 fixes the issue so doing that for now. Not sure if there's a lot between the 2 versions

alexbosworth commented 5 years ago

What node.js version are you using?

otech47 commented 5 years ago

What node.js version are you using?

Screen Shot 2019-07-27 at 12 13 34 AM
alexbosworth commented 5 years ago

Yeah ok the newer version requires node 10.4+ I guess because it started using BigInt

otech47 commented 5 years ago

Cool yeah that works thanks for the help! 👍

Easy docs PR if you want it: https://github.com/alexbosworth/ln-service/compare/master...otech47:otech47-node-version

alexbosworth commented 5 years ago

Ok great

I'll update the package to reflect the requirement