Error [ERR_MODULE_NOT_FOUND]

Hello! I’m trying to deploy my backend but it keeps failing cause of the error below. I’ve looked through other topics here but nothing seems to help. I’m new to TypeScript and Express so I might’ve done something wrong somewhere but locally everything is working just fine.

==> Running ‘npx tsx server.ts’

Jun 10 09:39:26 PM

Jun 10 09:39:26 PMnode:internal/process/esm_loader:34

Jun 10 09:39:26 PM internalBinding(‘errors’).triggerUncaughtException(

Jun 10 09:39:26 PM ^

Jun 10 09:39:26 PMError [ERR_MODULE_NOT_FOUND]: Cannot find module ‘/opt/render/project/src/server/models/List’ imported from /opt/render/project/src/server/controllers/listController.ts

Jun 10 09:39:26 PM at finalizeResolution (node:internal/modules/esm/resolve:264:11)

Jun 10 09:39:26 PM at moduleResolve (node:internal/modules/esm/resolve:917:10)

Jun 10 09:39:26 PM at defaultResolve (node:internal/modules/esm/resolve:1130:11)

Jun 10 09:39:26 PM at nextResolve (node:internal/modules/esm/hooks:865:28)

Jun 10 09:39:26 PM at d (file:///opt/render/project/src/server/node_modules/tsx/dist/esm/index.mjs:5:34)

Jun 10 09:39:26 PM at F (file:///opt/render/project/src/server/node_modules/tsx/dist/esm/index.mjs:5:1169)

Jun 10 09:39:26 PM at nextResolve (node:internal/modules/esm/hooks:865:28)

Jun 10 09:39:26 PM at Hooks.resolve (node:internal/modules/esm/hooks:303:30)

Jun 10 09:39:26 PM at handleMessage (node:internal/modules/esm/worker:196:24)

Jun 10 09:39:26 PM at Immediate.checkForMessages (node:internal/modules/esm/worker:138:28) {

Jun 10 09:39:26 PM code: ‘ERR_MODULE_NOT_FOUND’,

Jun 10 09:39:26 PM url: ‘file:///opt/render/project/src/server/models/List’

Jun 10 09:39:26 PM}

Here is the github repo: GitHub - itsechi/typescript-todo
My root folder is set to server in the settings.

Your list.ts file has a lowercase l, your code specifies a capital L.

1 Like