Hi there,
First time posting and new here. Thanks in advance for helping me out.
I’m running into the following after my start command runs (this is a nodejs project):
==> Build successful 🎉
==> Deploying...
==> Running 'node dist/index.js'
node:internal/modules/cjs/loader:1147
throw err;
^
Error: Cannot find module '/opt/render/project/src/dist/index.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
at Module._load (node:internal/modules/cjs/loader:985:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v20.11.1
==> Exited with status 1```
Package.json
{
“name”: “bitespeed-identity-service”,
“version”: “1.0.0”,
“description”: “Identity reconciliation service”,
“main”: “dist/index.js”,
“engines”: {
“node”: “20.11.1”
},
“scripts”: {
“start”: “node dist/index.js”,
“build”: “npm install && rm -rf dist && tsc”,
“dev”: “ts-node-dev --respawn --transpile-only src/index.ts”,
“typeorm”: “typeorm-ts-node-commonjs”
},
“dependencies”: {
“express”: “^4.18.2”,
“pg”: “^8.11.3”,
“typeorm”: “^0.3.20”,
“reflect-metadata”: “^0.2.1”,
“dotenv”: “^16.4.5”,
“cors”: “^2.8.5”,
“helmet”: “^7.1.0”
},
“devDependencies”: {
“@types/express”: “^4.17.21”,
“@types/node”: “^20.11.24”,
“@types/pg”: “^8.11.2”,
“@types/cors”: “^2.8.17”,
“@types/helmet”: “^4.0.0”,
“ts-node”: “^10.9.2”,
“ts-node-dev”: “^2.0.0”,
“typescript”: “^5.3.3”
}
}
tsconfig.json
{
“compilerOptions”: {
“target”: “ES2020”,
“module”: “commonjs”,
“lib”: [“ES2020”, “DOM”],
“outDir”: “./dist”,
“rootDir”: “./src”,
“strict”: true,
“esModuleInterop”: true,
“skipLibCheck”: true,
“forceConsistentCasingInFileNames”: true,
“emitDecoratorMetadata”: true,
“experimentalDecorators”: true,
“strictPropertyInitialization”: false,
“resolveJsonModule”: true,
“moduleResolution”: “node”,
“sourceMap”: true,
“baseUrl”: “.”,
“paths”: {
“": ["src/”]
}
},
“include”: [“src/**/*”],
“exclude”: [“node_modules”, “dist”]
}
Project
├── dist/ # Compiled JavaScript files
│ ├── index.js
│ ├── index.js.map
│ ├── data-source.js
│ ├── data-source.js.map
│ ├── services/
│ └── entities/
├── src/ # Source TypeScript files
│ ├── index.ts
│ ├── data-source.ts
│ ├── services/
│ └── entities/
├── node_modules/ # Dependencies
├── .git/ # Git repository
├── package.json # Project configuration
├── package-lock.json # Dependency lock file
├── tsconfig.json # TypeScript configuration
├── render.yaml # Render deployment configuration
├── .gitignore # Git ignore rules
├── .npmrc # NPM configuration
└── README.md # Project documentation
In my settings, I have the following:
Root directory: blank
Build command: npm install && npm run build
Start command: node dist/index.js
This all works locally, so I’m unsure what might be happening. The index.js file does exist after running the build command.