I am keep getting ERR_MODULE_NOT_FOUND when I deploy my main branch

Sep 19 11:49:04 AM Error [ERR_MODULE_NOT_FOUND]: Cannot find module ‘/opt/render/project/src/src/controller/eventsController.js’ imported from /opt/render/project/src/src/routes/eventsRoute.js
Sep 19 11:49:04 AM at new NodeError (node:internal/errors:372:5)
Sep 19 11:49:04 AM at finalizeResolution (node:internal/modules/esm/resolve:437:11)
Sep 19 11:49:04 AM at moduleResolve (node:internal/modules/esm/resolve:1009:10)
Sep 19 11:49:04 AM at defaultResolve (node:internal/modules/esm/resolve:1218:11)
Sep 19 11:49:04 AM at ESMLoader.resolve (node:internal/modules/esm/loader:580:30)
Sep 19 11:49:04 AM at ESMLoader.getModuleJob (node:internal/modules/esm/loader:294:18)
Sep 19 11:49:04 AM at ModuleWrap. (node:internal/modules/esm/module_job:80:40)
Sep 19 11:49:04 AM at link (node:internal/modules/esm/module_job:78:36) {
Sep 19 11:49:04 AM code: ‘ERR_MODULE_NOT_FOUND’
Sep 19 11:49:04 AM }

Here is how my directory looks

I am using yarn server.js to start my project

Hi Karan,

MODULE_NOT_FOUND is Node’s way of telling you ‘file not found’ - it’s important to remember that most hosting providers will be using Linux, which is a CASE-SENSITIVE file system, so when you have an error like showing:

/opt/render/project/src/src/controller/eventsController.js’

then the casing needs to match exactly that, you don’t open the ‘controller’ folder in that screenshot but I’d hazard a guess that the file name isn’t eventsController.js but some other casing of it.

John B
Render Support, UTC+1 :uk:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.