Error: Cannot find module '/opt/render/project/src/node_modules/retry-as-promised/dist/index.js'

Hello there!
It’s my very first project at Render. Obiviosly, it’s my first ever big project during my education =)

My goal is to deploy server with DB Postgres on Render.
This morning I finished first part, but after adding some code to connect to Postgres, this error appeared:

Error: Cannot find module ‘/opt/render/project/src/node_modules/retry-as-promised/dist/index.js’

My package.json:

{
  "name": "be_product_catalog",
  "version": "1.0.0",
  "description": "",
  "main": "dist/main.js",
  "type": "module",
  "scripts": {
    "postinstall": "npm install @types/dotenv @types/sequelize",
    "start": "node dist/main.js",
    "build": "tsc",
    "dev": "nodemon --watch src --ext ts --exec ts-node src/main.ts"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@swc/core": "^1.3.104",
    "@types/cors": "^2.8.17",
    "@types/dotenv": "^8.2.0",
    "@types/express": "^4.17.21",
    "@types/node": "^20.11.5",
    "@types/sequelize": "^4.28.20",
    "dotenv": "^16.3.2",
    "nodemon": "^3.0.3",
    "sequelize": "^6.35.2",
    "typescript": "^5.3.3"
  },
  "dependencies": {
    "cors": "^2.8.5",
    "dotenv": "^16.3.2",
    "express": "^4.18.2",
    "pg": "^8.11.3",
    "sequelize": "^6.35.2",
    "ts-node": "^10.9.2"
  }
}

And (if nessesary), other part of error message:

 at tryPackage (node:internal/modules/cjs/loader:444:19)
    at Module._findPath (node:internal/modules/cjs/loader:715:18)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1130:27)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/opt/render/project/src/node_modules/sequelize/lib/sequelize.js:24:15)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32) {
  code: 'MODULE_NOT_FOUND',
  path: '/opt/render/project/src/node_modules/retry-as-promised/package.json',
  requestPath: 'retry-as-promised'
}

Please, help me resolve this.

Hi,

That error sounds like you might not have installed your dependencies, e.g. npm install in your Build Command.

Alan

1 Like

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