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?