SyntaxError: Unexpected token '?=' - Help

I am trying to deploy my app on render and I am facing following error.

/usr/src/app/node_modules/bson/lib/bson.cjs:593
Mar 1 11:58:18 PM inspect ??= defaultInspect;
Mar 1 11:58:18 PMSyntaxError: Unexpected token ‘??=’
Mar 1 11:58:18 PM at wrapSafe (internal/modules/cjs/loader.js:1029:16)
Mar 1 11:58:18 PM at Module._compile (internal/modules/cjs/loader.js:1078:27)
Mar 1 11:58:18 PM at Object.Module._extensions…js (internal/modules/cjs/loader.js:1143:10)
Mar 1 11:58:18 PM at Module.load (internal/modules/cjs/loader.js:979:32)
Mar 1 11:58:18 PM at Function.Module._load (internal/modules/cjs/loader.js:819:12)
Mar 1 11:58:18 PM at Module.require (internal/modules/cjs/loader.js:1003:19)
Mar 1 11:58:18 PM at require (internal/modules/cjs/helpers.js:107:18)
Mar 1 11:58:18 PM at Object. (/usr/src/app/node_modules/mongoose/node_modules/mongodb/lib/bson.js:4:14)
Mar 1 11:58:18 PM at Module._compile (internal/modules/cjs/loader.js:1114:14)
Mar 1 11:58:18 PM at Object.Module._extensions…js (internal/modules/cjs/loader.js:1143:10)
Mar 1 11:58:20 PM==> Common ways to troubleshoot your deploy: Troubleshooting Your Deploy | Render Docs

I tried defining NODE_VERSION in environment variables to the version I am running in local, still facing same issue. I check locally its 18.19.1 so I set the same in render env variables.

I also tried to include engines{node:“18.19.1”} in package.json, and it didn’t work.

I also followed this Setting Your Node.js Version | Render Docs but nothing worked.
Is there anyone facing issues similar to this and how to resolve this?

What’s the version you’re seeing at the top of your logs for an attempted deploy?

For example, here’s one of my deploys (surrounding lines for context):

We can see that it’s using 20.11.1, which is the current default for services created today.

1 Like

I can’t see node version during this deploy, I can only see something like shown in this image.
While I checked the Image that I generated through github, I can see that Node version is 18.19.1

But in the terminal when I check latest node version its v21.5.0

The Node version is listed just above what you screenshot. It is always listed.

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