1

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.

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I ended up going with ioredis which just worked, but I was running 14.17.3, which is what made this very odd.
0

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

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.