mongodbmongoosebackendrender

inspect ??= defaultInspect when deploy backend on server


/opt/render/project/src/node_modules/bson/lib/bson.cjs:479
Nov 5 12:36:13 PM          inspect ??= defaultInspect;
Nov 5 12:36:13 PM                  ^^^
Nov 5 12:36:13 PM  
Nov 5 12:36:13 PM  SyntaxError: Unexpected token '??='
Nov 5 12:36:13 PM      at wrapSafe (internal/modules/cjs/loader.js:984:16)
Nov 5 12:36:13 PM      at Module._compile (internal/modules/cjs/loader.js:1032:27)
Nov 5 12:36:13 PM      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
Nov 5 12:36:13 PM      at Module.load (internal/modules/cjs/loader.js:933:32)
Nov 5 12:36:13 PM      at Function.Module._load (internal/modules/cjs/loader.js:774:14)
Nov 5 12:36:13 PM      at Module.require (internal/modules/cjs/loader.js:957:19)
Nov 5 12:36:13 PM      at require (internal/modules/cjs/helpers.js:88:18)
Nov 5 12:36:13 PM      at Object.<anonymous> (/opt/render/project/src/node_modules/mongodb/lib/bson.js:4:14)
Nov 5 12:36:13 PM      at Module._compile (internal/modules/cjs/loader.js:1068:30)

i have change the run command like node index.js or nodemon index.js == start

"start" = "nodemon index.js"
"start" = "node index.js"

but still facing issue


Solution

  • I hope you are using Render. Render includes Node.js with a default version of 14.17.0. If you need to use a different Node.js version for your application, you can easily make this adjustment within the platform. To do so, navigate to your application’s environment settings on Render, and create an environment variable called NODE_VERSION. Set the value of NODE_VERSION to match the specific Node.js version that you have thoroughly tested with your application.

    Example:

    • Key: NODE_VERSION
    • Value: 18.5

    enter image description here