David
David

Reputation: 7456

node-redis createClient SyntaxError: Invalid or unexpected token

Just added node-redis and my node version is 14.17.3

node_modules/@redis/client/dist/lib/cluster/cluster-slots.js:89
        return node.client ?? __classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_createNodeClient).call(this, node);
                            ^

SyntaxError: Invalid or unexpected token
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)

Error happens with any mention of createClient. Don't even have to make a call with it.

Upvotes: 1

Views: 782

Answers (2)

Himalaya Creation
Himalaya Creation

Reputation: 11

Install "redis": "^3.0.2" version then it will work 200%..

I had wasted my whole day in this issue...hope it helped..

Upvotes: 0

Simon Prickett
Simon Prickett

Reputation: 4158

That's using the nullish coalescing operator:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing

This was added to Node.js in version 14.5.0 according to https://node.green - wondering if you are sure you're running 14.17.3? If you're running an older version of Node you should update to a newer one.

Upvotes: 1

Related Questions