Error: Cannot find module '/opt/render/project/src/server/index.js'

I’m a beginner, I just deployed my server here.
I’m not getting why it is showing this error.

My package.json file is
{
“name”: “server”,
“version”: “1.0.0”,
“description”: “”,
“main”: “src/index.js”,
“scripts”: {
“start”:“node index.js”
},
“author”: “Mahesh Uppunuthula”,
“license”: “ISC”,
“dependencies”: {
“bcrypt”: “^5.1.0”,
“cors”: “^2.8.5”,
“dotenv”: “^16.0.3”,
“express”: “^4.18.2”,
“jsonwebtoken”: “^9.0.0”,
“lodash”: “^4.17.21”,
“mongoose”: “^7.2.0”
}
}
I am using “npm install” as build command and “node app.js” as start command.

this is the git hub repo I want to deploy:

Hi,

The error is correct, there isn’t an index.js under the server folder in the repo you shared: https://github.com/Mahesh-Uppunuthula/Snip-Ninja/tree/master/server

There does seem to be one in /server/srv/index.js: https://github.com/Mahesh-Uppunuthula/Snip-Ninja/tree/master/server/src

You’ll need to check your references.

Alan

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