Error: Cannot find module '/opt/render/project/src/listen.js'

I keep getting this error message:

Error: Cannot find module ‘/opt/render/project/src/listen.js’
Jan 16 10:29:05 AM at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
Jan 16 10:29:05 AM at Function.Module._load (internal/modules/cjs/loader.js:730:27)
Jan 16 10:29:05 AM at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
Jan 16 10:29:05 AM at internal/main/run_main_module.js:17:47 {
Jan 16 10:29:05 AM code: ‘MODULE_NOT_FOUND’,
Jan 16 10:29:05 AM requireStack:
Jan 16 10:29:05 AM }

The listen.js file is right there in the root directory. Everything’s working fine locally and in ElephantSQL. I’ve got the exact same settings on another project that’s working fine. Any idea what could be wrong this time?
My package.json looks like this:

{
“name”: “be-nc-news”,
“version”: “1.0.0”,
“description”: “be-nc-news”,
“main”: “listen.js”,
“scripts”: {
“start”: “node listen.js”,
“setup-dbs”: “psql -f ./db/setup.sql”,
“seed”: “node db/seeds/run-seed.js”,
“seed-prod”: “NODE_ENV=production npm run seed”,
“test”: “jest”,
“prepare”: “husky install”
},
“repository”: {
“type”: “git”,
“url”: “git+https://github.com/northcoders/be-nc-news.git”
},
“keywords”: ,
“author”: “”,
“license”: “ISC”,
“bugs”: {
“url”: “https://github.com/northcoders/be-nc-news/issues
},
“homepage”: “https://github.com/northcoders/be-nc-news#readme”,
“devDependencies”: {
“husky”: “^7.0.4”,
“jest”: “^27.5.1”,
“jest-extended”: “^2.0.0”
},
“dependencies”: {
“cors”: “^2.8.5”,
“dotenv”: “^16.0.0”,
“express”: “^4.18.1”,
“jest-sorted”: “^1.0.14”,
“pg”: “^8.7.3”,
“pg-format”: “^1.0.4”,
“supertest”: “^6.2.4”
},
“jest”: {
“setupFilesAfterEnv”: [
“jest-extended/all”,
“jest-sorted”
]
}
}

Hi,

Linux filesystems are case-sensitive, does the case of the filename match how it’s referenced in the code? E.g. listen.js is different to Listen.js.

Alan

Hi,
Yeah I’ve checked the filenames and references. They’re all lowercase and all match. I’ve got another project with pretty much the exact same settings that was deployed without problems, so I’m really confused about what’s wrong with this one.
Carlie

Everything points to the listen.js file being missing or incorrectly referenced/cased. Without seeing the repo or the service, we’ll have to leave it you to track down the issue.

Maybe double check you are deploying the repo AND branch you expect.

Alan