How do i solve this please?

hello.
when i tried to run my code on localhost it worked fine
but when i try to deploy it i see this error

/rbd/pnpm-volume/d6843686-3ceb-459c-b878-d9af01b51241/node_modules/.registry.npmjs.org/mongodb/5.8.1/node_modules/mongodb/lib/operations/add_user.js:16

this.options = options ?? {};

SyntaxError: Unexpected token ?
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (/rbd/pnpm-volume/d6843686-3ceb-459c-b878-d9af01b51241/node_modules/.registry.npmjs.org/mongodb/5.8.1/node_modules/mongodb/lib/admin.js:4:20)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:789:10)

i dont know what could be wrong

I’ve solved the problem…
The default node version is version 10 and my code required version 16 so in the package.json file I added an engine object

“engines”: { “node”: “16.x” }

2 Likes

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