Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/opt/render/project/src/dist/db/index'

I have checked similar posts about the same error but still getting the same. The error states that the dist/ don’t have db/index.js which it has. Need help with this. Thank you in advance.


  "name": "server",
  "version": "1.0.0",
  "description": "Pollution tracker to report Pollution incidents in nearby locations.",
  "main": "index.ts", 
  "type": "module",
  "scripts": {
    "build": "npm install typescript && npx tsc && ls -l ./dist && ls -l ./dist/db",
    "start": "node --es-module-specifier-resolution=node ./dist/index.js",
    "dev": "nodemon index.ts"

Project structure

Github link → GitHub - Michle99/server


Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/opt/render/project/src/dist/db/index' imported from /opt/render/project/src/dist/index.js

  url: 'file:///opt/render/project/src/dist/db/index'


I may be missing something here… but the error message is referring to your db/index file as ‘/opt/render/project/src/dist/db/index’ without the .js extension. Are you sure that you’re looking at the right file?

I know there are a bunch of bundlers that can resolve files without their extension specified but I somehow have no recall of seeing a full path like that without the extension.

Render Support, UTC+3

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