This.options = options ? {};


I run this backend on windows and kali linux worked perfectly but when I tried on ubuntu then it showed an error. could anybody help me?

my code is

Hello @Abu_Said_Shabib, Welcome to the MongoDB community forum,

I think you are using mongodb npm’s latest driver version 5, and there are Build and Dependency Changes, Just make sure the below thing,

Minimum supported Node version
The new minimum supported Node.js version is now 14.20.1

1 Like

Hi, Were you able to find a solution to this problem? I haven’t been lucky so far.
I have been facing server connection problems due to things (not sure if it’s because of a firewall or vpn or zscaler) but I Started facing this specific problem yesterday after I removed MongoDB from package.json file, deleted package-lock and node-modules and then reinstalled everything, then installed mongo db again.
I am facing the same error and I haven’t been able to find other questions related to it on the the internet maybe Im looking for the wrong thing in the wrong places.
please help.

attaching SS of my package.json file.

I am using node version 19.8.0

I can’t solve it but it’s probably problem on Ubuntu network | Firewall | Version or security related issues. Because in other versions of linux it working well. Like I’m tested on kali linux, fedora and zorin os.

I’m facing this problem on MacOS Ventura 13.1, my colleague with his MacOS is not facing this issue. I don’t understand what the problem could be.

Firewall seems like a probable cause since my colleague has been here longer he must have different access than my laptop (he doesn’t remember, I tried asking him what special permissions his laptop might have).

my problem is fixed now,
it was due to my company’s internet monitoring software blocking the ports I needed to visit. took me a long time to figure it out because the software is newly implemented and the team handling it wasn’t aware that it blocks ports too, not just website.

1 Like

Reciently I find a solution. The comand “npm i mongoose” today install mongoose version 7.0.1., so I deleted directory “node_modules” and after I rewrite the file “package.json” to replace dependencies as “mongoose”: “^5.1.2”, and ejecute command “npm i dependences” and node.js will reinstall mongoose in a past version. this works fine for my.

4 Likes

Hello :wave: @Najib_Shah / @Abu_Said_Shabib / @Ramirez_Gomar_Sergio_Jose

Welcome to the MongoDB Community forums :sparkles:

As @turivishal mentioned the minimum supported Node.js version is now 14.20.1 for MongoDB Node.js Driver v5. So, please upgrade the node version to 14.20.1 or higher to resolve the issue.

However, you can refer to my response here where I’ve explained the cause of the this.options = options ?? {}; error.

I hope it helps!

Regards,
Kushagra

1 Like

Thank you so much.
my problem is resolve due to your solution.

1 Like

3 posts were split to a new topic: Getting Error This.options = options ? {};

This worked for me, I downgraded the mongoose version to ^5.1.2 from ^7.5.2

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.