Cannot find module '/opt/render/project/src/start'

My Project Structure
client
server.js
other files
.
.
.

The error I am getting while deployment

my package.json
{
“name”: “rebooked-2.0”,
“version”: “1.0.0”,
“description”: “rebooked for gsc”,
“main”: “server.js”,
“scripts”: {
“test”: “echo "Error: no test specified" && exit 1”,
“start”: “node server.js”,
“server”: “nodemon server.js”,
“client”: “npm start --prefix ./client”,
“dev”: “concurrently "npm start" "npm run client"”
},
“author”: “spriha anand”,
“license”: “ISC”,
“dependencies”: {
“bcryptjs”: “^2.4.3”,
“colors”: “^1.4.0”,
“concurrently”: “^8.2.2”,
“cors”: “^2.8.5”,
“dotenv”: “^16.4.5”,
“express”: “^4.19.2”,
“jsonwebtoken”: “^9.0.2”,
“moment”: “^2.30.1”,
“mongoose”: “^8.4.1”,
“morgan”: “^1.10.0”,
“nodemon”: “^3.1.3”
}
}

server.js
const express = require(‘express’)

const dotenv = require(‘dotenv’)

const colors = require(‘colors’)

const morgan = require(‘morgan’)

const cors = require(‘cors’)

const { connect } = require(‘mongoose’)

const connectDB = require(‘./config/db’)

const path = require(‘path’)

//dot config

dotenv.config()

//mongodb connection

connectDB();

//rest object

//storing all functionality of express objects in a var

const app = express()

//middleware

app.use(cors())

app.use(express.json())

app.use(morgan(‘dev’))

//routes

// test route

app.use(“/api/v1/test”, require(“./routes/testRoutes”));

// http://localhost:8080/test

app.use(“/api/v1/auth”, require(“./routes/authRoutes”))

app.use(“/api/v1/inventory”, require(“./routes/inventoryRoutes”))

app.use(“/api/v1/analytics”, require(“./routes/analyticsRoutes”))

app.use(“/api/v1/admin”, require(“./routes/adminRoutes”))

app.use(express.static(path.join(__dirname,“./client/build”)))

app.get(‘*’, function(req, res){

res.sendFile(path.join(__dirname, “./client/build/index.html”))

})

const PORT = process.env.PORT || 8080;

//listen

app.listen(PORT, ()=>{

console.log(Node server running in Mode : ${process.env.DEV_MODE} at PORT ${process.env.PORT}.bgCyan.white)

})

Hi there,

Change your start command to npm start (or node server.js) node start will try and run a start module, which doesn’t exist.

Regards,

Keith
Render Support, UTC+10 :australia:


hey Keith I am getting the same problem
here is my package json

{
“name”: “linkpod-server”,
“version”: “1.0.0”,
“description”: “Extension for linkedIn, help user to make post, comment, like”,
“main”: “app.js”,
“scripts”: {
“start”: “node app.js”,
“dev”: “nodemon -r dotenv/config app.js”
},
“repository”: {
“type”: “git”,
“url”: “git+https://github.com/ritikraj07/LinkPod-Server.git”
},
“keywords”: [
“linkpod-server”
],
“author”: “Ritik Raj”,
“license”: “ISC”,
“bugs”: {
“url”: “https://github.com/ritikraj07/LinkPod-Server/issues
},
“homepage”: “https://github.com/ritikraj07/LinkPod-Server#readme”,
“dependencies”: {
“axios”: “^1.6.7”,
“bcrypt”: “^5.1.1”,
“cookie-parser”: “^1.4.6”,
“cors”: “^2.8.5”,
“dotenv”: “^16.3.1”,
“express”: “^4.18.2”,
“express-session”: “^1.18.0”,
“express-status-monitor”: “^1.2.3”,
“jsonwebtoken”: “^9.0.2”,
“mongoose-aggregate-paginate-v2”: “^1.0.7”,
“mongoose-paginate-v2”: “^1.8.0”,
“mongoosh”: “^0.0.7”,
“morgan”: “^1.10.0”,
“node-cron”: “^3.0.3”,
“nodemailer”: “^6.9.12”,
“prettier”: “^3.2.5”,
“querystring”: “^0.2.1”,
“serverless-http”: “^3.2.0”
}
}

can you tell me what’s the problme

Hi there,

Please note I can’t see your code base, so I’m guessing the answer here. Your package.json has node app.js for its start script, but on Render you are running node api.js for you start command. Do you have a api.js script in your repo?

Regards,

Keith
Render Support, UTC+10 :australia: