Node.js v12 support
TennousuAthena opened this issue · 10 comments
I run it on node.js v12, however, it threw an exception that won't happen on v14+
SyntaxError: Unexpected token "."
const temp = this._cache?.[uid]?.info;
I'm familiar with neither Node.js nor Typescript, how to fix it?
Could you provide full stacktrace and your OS environment? This should be helpful to find out the cause.
Could you provide full stacktrace and your OS environment? This should be helpful to find out the cause.
Sure!
root@ubuntu-chan:~/genshin-kit-master# node index.js
/root/genshin-kit-master/node_modules/genshin-kit/lib/index.js:75
const temp = this._cache?.[uid]?.info;
^
SyntaxError: Unexpected token .
at Module._compile (internal/modules/cjs/loader.js:723:23)
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 Object.<anonymous> (/root/genshin-kit-master/index.js:1:28)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
root@ubuntu-chan:~/genshin-kit-master# node -v
v10.19.0
root@ubuntu-chan:~/genshin-kit-master# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
According to Node.js documentation, v12 does not support ?.
syntax, which is introduced in ES2020. Can you upgrade your Node.js to v14?
Is there an alternative method?
I could upgrade to node.js v14 on my machine, however, I am trying to migrate the program to a Serverless provider which only supports Node.js v12
root@ubuntu-chan:~/genshin-kit-master# node -v
v10.19.0
Oh, well, that's a big problem.
We have used a lot of new features of es2020. Supporting older versions may require us to pay a heavy price... We will try our best to be compatible, but we don't give promise.
(BTW, Node12 is about to be abandoned, if I remember correctly)
We have used a lot of new features of es2020. Supporting older versions may require us to pay a heavy price... We will try our best to be compatible, but we don't give promise.
(BTW, Node12 is about to be abandoned, if I remember correctly)
It's OK.
Anyway, thanks for your devotion. ❤
@AlPha5130 Can we try to modify this configuration to ES5, etc?
If for v12 we can just use ES2019, instead of ES5.
genshin-kit@2.4.0
is now released. Can you give it a try?