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 '||=' on node < 15 #264

Closed
jtrull101 opened this issue Dec 5, 2023 · 7 comments
Closed

Unexpected token '||=' on node < 15 #264

jtrull101 opened this issue Dec 5, 2023 · 7 comments

Comments

@jtrull101
Copy link

Whether using the docker container or locally , I have been seeing this problem:

file:///{PATH}/free-games-claimer/gog.js:
89
db.data[user] ||= {};
^^^

SyntaxError: Unexpected token '||='
←[90m at Loader.moduleStrategy (internal/modules/esm/translators.js:145:18)←[39m
←[90m at async link (internal/modules/esm/module_job.js:63:21)←[39m

Same behavior for prime, gog, and epic

@jtrull101
Copy link
Author

Last successful fetch was "2023-11-03 06:30:29.881" according to the epic-games.json log

@vogler vogler changed the title Unable to run CLI Unexpected token '||=' Dec 18, 2023
@vogler
Copy link
Owner

vogler commented Dec 18, 2023

Can't reproduce. Looks like you use some very old version of node. ||= was added in v15:
https://stackoverflow.com/questions/69515305/logical-or-assignment-not-working-on-nodejs

The docker image has a newer version, so idk how that should be possible.

@vogler vogler closed this as not planned Won't fix, can't repro, duplicate, stale Dec 18, 2023
@vogler
Copy link
Owner

vogler commented Dec 18, 2023

Are you still on bullseye or which OS are you using?
https://packages.debian.org/search?keywords=nodejs

See https://nodejs.org/en/download/ for how to install a newer version.

@jtrull101
Copy link
Author

Running on Win 11. Node version reported by gitbash is v14.17.3
The date of the last fetch coincides with some angular work I was doing on my local environment with that node version. Thank you for looking into this

@vogler
Copy link
Owner

vogler commented Dec 18, 2023

But maybe a good idea to check the node version in the script if that's possible without tripping up the lexer already for old versions.

@vogler
Copy link
Owner

vogler commented Dec 19, 2023

Yea, as expected, doesn't work:
image
image
https://tio.run/#javascript-node

Could check node -v, but doesn't make sense to have some wrapper for that.

vogler added a commit that referenced this issue Dec 19, 2023
@vogler
Copy link
Owner

vogler commented Dec 19, 2023

Put the constraint in package.json such that it could be checked for #219 or npx.

@vogler vogler changed the title Unexpected token '||=' Unexpected token '||=' on node < 15 Dec 19, 2023
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

2 participants