Error: Cannot find module ‘/opt/render/project/src/app.js’

When I am deploying my website it is showing this error and my folder contains single file no any other directories like frontend backend, but I didn’t understand why render giving this error on deployment .
Please anyone help please please

Error;
Jul 9 02:05:42 PM Error: Cannot find module ‘/opt/render/project/src/server.js’
Jul 9 02:05:42 PM at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
Jul 9 02:05:42 PM at Function.Module._load (internal/modules/cjs/loader.js:730:27)
Jul 9 02:05:42 PM at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
Jul 9 02:05:42 PM at internal/main/run_main_module.js:17:47 {
Jul 9 02:05:42 PM code: ‘MODULE_NOT_FOUND’,
Jul 9 02:05:42 PM requireStack:

My package.json file is this
{
“name”: “fitness-website”,
“version”: “1.0.0”,
“description”: “”,
“main”: “index.js”,
“scripts”: {
“test”: “echo "Error: no test specified" && exit 1”,
“start”: “node server.js”
},
“author”: “”,
“license”: “ISC”,
“dependencies”: {
“body-parser”: “^1.20.1”,
“dotenv”: “^16.0.3”,
“ejs”: “^3.1.8”,
“express”: “^4.18.2”,
“express-session”: “^1.17.3”,
“mongoose”: “^6.7.4”,
“mongoose-findorcreate”: “^3.0.0”,
“passport”: “^0.6.0”,
“passport-facebook”: “^3.0.0”,
“passport-github2”: “^0.1.12”,
“passport-google-oauth20”: “^2.0.0”,
“passport-local-mongoose”: “^7.1.2”
}
}

Hi there,

The code in your GitHub repo for your application is in a subdirectory. You should update the settings on your service to set the root directory to this subdirectory. Note that it also has a space in the directory name, I would recommend using a - or a _ instead of space in the same. It may cause problems as the space probably will need to be escaped.

Regards,

Keith
Render Support, UTC+10 :australia:

According to your solution I try to do but it is giving this.

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