Error: Cannot find module '../Controllers/Agent.controller'

Dear Team,

I have tried to load my backend project using service web but I got an error saying that the module doesn’t exist but I am sure that the correct file exist!!!
Have you any idea about this issue? How can I resolve it?
Please find below the detail.
Thanks a lot

Jan 16 10:55:25 PM ==> Cloning from GitHub - KhadidjaOuarab/ADMAH_Backend
Jan 16 10:55:26 PM ==> Checking out commit d787011ee2d32153dbaf7ba6851eb14b5e90944b in branch main
Jan 16 10:55:30 PM ==> Running build command ‘npm install’…
Jan 16 10:55:39 PM
Jan 16 10:55:39 PM > bcrypt@5.1.0 install /opt/render/project/src/node_modules/bcrypt
Jan 16 10:55:39 PM > node-pre-gyp install --fallback-to-build
Jan 16 10:55:39 PM
Jan 16 10:55:39 PM [bcrypt] Success: “/opt/render/project/src/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node” is installed via remote
Jan 16 10:55:40 PM updated 277 packages and audited 278 packages in 9.153s
Jan 16 10:55:40 PM
Jan 16 10:55:40 PM 19 packages are looking for funding
Jan 16 10:55:40 PM run npm fund for details
Jan 16 10:55:40 PM
Jan 16 10:55:40 PM found 4 vulnerabilities (3 moderate, 1 high)
Jan 16 10:55:40 PM run npm audit fix to fix them, or npm audit for details
Jan 16 10:55:40 PM ==> Generating container image from build. This may take a few minutes…
Jan 16 10:56:45 PM ==> Uploading build…
Jan 16 10:57:11 PM ==> Build uploaded in 21s
Jan 16 10:57:12 PM ==> Build successful :tada:
Jan 16 10:57:12 PM ==> Deploying…
Jan 16 10:57:24 PM ==> Starting service with ‘node server.js’
Jan 16 10:57:28 PM internal/modules/cjs/loader.js:888
Jan 16 10:57:28 PM throw err;
Jan 16 10:57:28 PM ^
Jan 16 10:57:28 PM
Jan 16 10:57:28 PM Error: Cannot find module ‘…/Controllers/Agent.controller’
Jan 16 10:57:28 PM Require stack:
Jan 16 10:57:28 PM - /opt/render/project/src/Routers/Agent.route.js
Jan 16 10:57:28 PM - /opt/render/project/src/server.js
Jan 16 10:57:28 PM at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
Jan 16 10:57:28 PM at Function.Module._load (internal/modules/cjs/loader.js:730:27)
Jan 16 10:57:28 PM at Module.require (internal/modules/cjs/loader.js:957:19)
Jan 16 10:57:28 PM at require (internal/modules/cjs/helpers.js:88:18)
Jan 16 10:57:28 PM at Object. (/opt/render/project/src/Routers/Agent.route.js:7:25)
Jan 16 10:57:28 PM at Module._compile (internal/modules/cjs/loader.js:1068:30)
Jan 16 10:57:28 PM at Object.Module._extensions…js (internal/modules/cjs/loader.js:1097:10)
Jan 16 10:57:28 PM at Module.load (internal/modules/cjs/loader.js:933:32)
Jan 16 10:57:28 PM at Function.Module._load (internal/modules/cjs/loader.js:774:14)
Jan 16 10:57:28 PM at Module.require (internal/modules/cjs/loader.js:957:19) {
Jan 16 10:57:28 PM code: ‘MODULE_NOT_FOUND’,
Jan 16 10:57:28 PM requireStack: [
Jan 16 10:57:28 PM ‘/opt/render/project/src/Routers/Agent.route.js’,
Jan 16 10:57:28 PM ‘/opt/render/project/src/server.js’
Jan 16 10:57:28 PM ]
Jan 16 10:57:28 PM }
Jan 16 10:57:34 PM ==> Starting service with ‘node server.js’
Jan 16 10:57:37 PM internal/modules/cjs/loader.js:888
Jan 16 10:57:37 PM throw err;
Jan 16 10:57:37 PM ^
Jan 16 10:57:37 PM
Jan 16 10:57:37 PM Error: Cannot find module ‘…/Controllers/Agent.controller’
Jan 16 10:57:37 PM Require stack:
Jan 16 10:57:37 PM - /opt/render/project/src/Routers/Agent.route.js
Jan 16 10:57:37 PM - /opt/render/project/src/server.js
Jan 16 10:57:37 PM at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
Jan 16 10:57:37 PM at Function.Module._load (internal/modules/cjs/loader.js:730:27)
Jan 16 10:57:37 PM at Module.require (internal/modules/cjs/loader.js:957:19)
Jan 16 10:57:37 PM at require (internal/modules/cjs/helpers.js:88:18)
Jan 16 10:57:37 PM at Object. (/opt/render/project/src/Routers/Agent.route.js:7:25)
Jan 16 10:57:37 PM at Module._compile (internal/modules/cjs/loader.js:1068:30)
Jan 16 10:57:37 PM at Object.Module._extensions…js (internal/modules/cjs/loader.js:1097:10)
Jan 16 10:57:37 PM at Module.load (internal/modules/cjs/loader.js:933:32)
Jan 16 10:57:37 PM at Function.Module._load (internal/modules/cjs/loader.js:774:14)
Jan 16 10:57:37 PM at Module.require (internal/modules/cjs/loader.js:957:19) {
Jan 16 10:57:37 PM code: ‘MODULE_NOT_FOUND’,
Jan 16 10:57:37 PM requireStack: [
Jan 16 10:57:37 PM ‘/opt/render/project/src/Routers/Agent.route.js’,
Jan 16 10:57:37 PM ‘/opt/render/project/src/server.js’
Jan 16 10:57:37 PM ]
Jan 16 10:57:37 PM }
Jan 16 10:58:01 PM ==> Starting service with ‘node server.js’
Jan 16 10:58:05 PM internal/modules/cjs/loader.js:888
Jan 16 10:58:05 PM throw err;
Jan 16 10:58:05 PM ^
Jan 16 10:58:05 PM
Jan 16 10:58:05 PM Error: Cannot find module ‘…/Controllers/Agent.controller’
Jan 16 10:58:05 PM Require stack:
Jan 16 10:58:05 PM - /opt/render/project/src/Routers/Agent.route.js
Jan 16 10:58:05 PM - /opt/render/project/src/server.js
Jan 16 10:58:05 PM at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
Jan 16 10:58:05 PM at Function.Module._load (internal/modules/cjs/loader.js:730:27)
Jan 16 10:58:05 PM at Module.require (internal/modules/cjs/loader.js:957:19)
Jan 16 10:58:05 PM at require (internal/modules/cjs/helpers.js:88:18)
Jan 16 10:58:05 PM at Object. (/opt/render/project/src/Routers/Agent.route.js:7:25)
Jan 16 10:58:05 PM at Module._compile (internal/modules/cjs/loader.js:1068:30)
Jan 16 10:58:05 PM at Object.Module._extensions…js (internal/modules/cjs/loader.js:1097:10)
Jan 16 10:58:05 PM at Module.load (internal/modules/cjs/loader.js:933:32)
Jan 16 10:58:05 PM at Function.Module._load (internal/modules/cjs/loader.js:774:14)
Jan 16 10:58:05 PM at Module.require (internal/modules/cjs/loader.js:957:19) {
Jan 16 10:58:05 PM code: ‘MODULE_NOT_FOUND’,
Jan 16 10:58:05 PM requireStack: [
Jan 16 10:58:05 PM ‘/opt/render/project/src/Routers/Agent.route.js’,
Jan 16 10:58:05 PM ‘/opt/render/project/src/server.js’
Jan 16 10:58:05 PM ]
Jan 16 10:58:05 PM }
Jan 16 10:58:38 PM ==> Starting service with ‘node server.js’
Jan 16 10:58:41 PM internal/modules/cjs/loader.js:888
Jan 16 10:58:41 PM throw err;
Jan 16 10:58:41 PM ^
Jan 16 10:58:41 PM
Jan 16 10:58:41 PM Error: Cannot find module ‘…/Controllers/Agent.controller’
Jan 16 10:58:41 PM Require stack:
Jan 16 10:58:41 PM - /opt/render/project/src/Routers/Agent.route.js
Jan 16 10:58:41 PM - /opt/render/project/src/server.js
Jan 16 10:58:41 PM at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
Jan 16 10:58:41 PM at Function.Module._load (internal/modules/cjs/loader.js:730:27)
Jan 16 10:58:41 PM at Module.require (internal/modules/cjs/loader.js:957:19)
Jan 16 10:58:41 PM at require (internal/modules/cjs/helpers.js:88:18)
Jan 16 10:58:41 PM at Object. (/opt/render/project/src/Routers/Agent.route.js:7:25)
Jan 16 10:58:41 PM at Module._compile (internal/modules/cjs/loader.js:1068:30)
Jan 16 10:58:41 PM at Object.Module._extensions…js (internal/modules/cjs/loader.js:1097:10)
Jan 16 10:58:41 PM at Module.load (internal/modules/cjs/loader.js:933:32)
Jan 16 10:58:41 PM at Function.Module._load (internal/modules/cjs/loader.js:774:14)
Jan 16 10:58:41 PM at Module.require (internal/modules/cjs/loader.js:957:19) {
Jan 16 10:58:41 PM code: ‘MODULE_NOT_FOUND’,
Jan 16 10:58:41 PM requireStack: [
Jan 16 10:58:41 PM ‘/opt/render/project/src/Routers/Agent.route.js’,
Jan 16 10:58:41 PM ‘/opt/render/project/src/server.js’
Jan 16 10:58:41 PM ]
Jan 16 10:58:41 PM }

Hi there

Check your casing, is it maybe controllers/agent.controller in linux upper/lower casing mattrs.

1 Like

thanks for getting back to me. it’s actually lowercase. now it works fine. Thanks