Node.js Deploy Issue: No open ports detected and other issues

Hello, I have several errors when trying deploy a Node.js web service that aren’t occurring when I run locally. I have npm install and npm start, referring to “nodemon src/index.js”, as the build and start commands. I have my port number and MongoDB Mongo_URI as environmental variables. I am using node version 20.12.2.

The first error I get is a “throw err:” directly after it reads the Mongo URI.
Then I get an error saying it cannot find the file that holds the Express model I created for my data.

Then I get this error: “[nodemon] app crashed - waiting for file changes before starting…”

And the last error is: “Port scan timeout reached, no open ports detected. Bind your service to at least one port. If you don’t need to receive traffic on any port, create a background worker instead.”

I would really appreciate any help I can get, thank you.

Hey,

nodemon is not recommended on Render, just call your start script directly, e.g. node src/index.js

Jérémy.
Render Support, UTC+3

Great, I will give that a try.

So I first tried it like this in the Render settings:
Start Command: node src/index.js

But it just stayed forever “in progress” without showing any logs so I canceled.

Then I changed my package.json script to: “start production”: “node src/index.js”
and changed in Render:
Start Command: start production

But it’s been 16 hours and the deploy is still “in progress” with no logs.

It’s loading now but I’m getting this error:

==> Running ‘node src/index.js’

node:internal/modules/cjs/loader:1146
throw err;
Error: Cannot find module ‘/opt/render/project/src/server/src/index.js’
at Module._resolveFilename (node:internal/modules/cjs/loader:1143:15)
at Module._load (node:internal/modules/cjs/loader:984:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49 {
ode: ‘MODULE_NOT_FOUND’,

Thank you, I got the site up and running.