the line that causes the problem is jus importing mongoose into the code
const mongoose = require("mongoose")
and it drops the error:
C:\Users\libor\OneDrive\Escritorio\todo\dev\Aplay\proyectos\mustang-oneclic\node_modules\mongodb\lib\operations\add_user.js:16
this.options = options ?? {};
^
SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (C:\Users\libor\OneDrive\Escritorio\todo\dev\Aplay\proyectos\mustang-oneclic\node_modules\mongodb\lib\admin.js:4:20)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
if I remove the require(
line the error doesn't apear
there is nothing interacting with mongodb nor mongoose, I have no clue what is happening
I tried installing mongodb in my pc again and removing the mongoose inport, nothing else is interacting with mongoose I expected it to import like normal
I fixed it It ended up being that the mongoose version was ahead of my node version, thus causing errors for using features my version doesn't have mongoose:"^7.4.1" node: v12.22.1
now I'm using: mongoose:"^5.9.20"