Node app - SyntaxError: Unexpected token '?='

i got an error while run my node app.

/node_modules/bson/lib/bson.cjs:479
inspect ??= defaultInspect;
                ^^^

SyntaxError: Unexpected token '??='

i am using ubuntu 20.04
node -v v14.21.3
Using MongoDB: v7.0.4
Using Mongosh: v2.1.1

Hi @Thoufeeq_N_A

For your version of node the diver will need to be 5.6.X to 5.9.X

npm install mongodb@"<6"

To run the latest version of the driver you will need to be on node 16.20.1 or above.

https://www.mongodb.com/docs/drivers/node/current/compatibility/

2 Likes

Thanx. This worked for me. Great help.