Cannot find module '../model/user.js'

I have been trying to deploy my school project since yesterday with no luck:

node:internal/modules/cjs/loader:1147

Apr 29 05:06:13 PM throw err;

Apr 29 05:06:13 PM ^

Apr 29 05:06:13 PM

Apr 29 05:06:13 PMError: Cannot find module ‘…/model/user.js’

Apr 29 05:06:13 PMRequire stack:

Apr 29 05:06:13 PM- /opt/render/project/src/routes/index.js

Apr 29 05:06:13 PM- /opt/render/project/src/App.js

Apr 29 05:06:13 PM at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)

Apr 29 05:06:13 PM at Module._load (node:internal/modules/cjs/loader:985:27)

Apr 29 05:06:13 PM at Module.require (node:internal/modules/cjs/loader:1235:19)

Apr 29 05:06:13 PM at require (node:internal/modules/helpers:176:18)

Apr 29 05:06:13 PM at Object. (/opt/render/project/src/routes/index.js:9:14)

Apr 29 05:06:13 PM at Module._compile (node:internal/modules/cjs/loader:1376:14)

Apr 29 05:06:13 PM at Module._extensions…js (node:internal/modules/cjs/loader:1435:10)

Apr 29 05:06:13 PM at Module.load (node:internal/modules/cjs/loader:1207:32)

Apr 29 05:06:13 PM at Module._load (node:internal/modules/cjs/loader:1023:12)

Apr 29 05:06:13 PM at Module.require (node:internal/modules/cjs/loader:1235:19) {

Apr 29 05:06:13 PM code: ‘MODULE_NOT_FOUND’,

Apr 29 05:06:13 PM requireStack: [

Apr 29 05:06:13 PM ‘/opt/render/project/src/routes/index.js’,

Apr 29 05:06:13 PM ‘/opt/render/project/src/App.js’

Apr 29 05:06:13 PM ]

Apr 29 05:06:13 PM}

Apr 29 05:06:13 PM

Apr 29 05:06:13 PMNode.js v20.11.1

I was able to narrow down the issue to the index.js file from the routes folder. This is the structure:
| App.js
| output.txt
| package-lock.json
| package.json
|
±–helpers
| populateReplies.js
|
±–middleware
| index.js
|
±–model
| comment.js
| post.js
| topic.js
| user.js
|
±–public
| ±–css
| | style.css
| |
| ±–js
| | theme.js
| |
| ±–uploads
| | DefaultPic.png
| | 1-1713612702670.png
| | 2-1713363952479.jpg
| |
| -–upload_image
| uploadProfilePic.js
|
±–routes
| | index.js
| | user.js
| |
| ±–forum
| | comment.js
| | post.js
| | topic.js
| |
| -–wiki
| wiki.js
|
-–views
| bootstrapDarkMode.ejs
| home.ejs
| login.ejs
| logSuccess.ejs
| register.ejs
|
±–forum
| ±–comments
| | | edit.ejs
| | | new.ejs
| | |
| | -–replies
| | edit.ejs
| | new.ejs
| |
| ±–posts
| | edit.ejs
| | index.ejs
| | new.ejs
| | show.ejs
| |
| -–topics
| edit.ejs
| index.ejs
| new.ejs
|
±–partials
| breadcrumb.ejs
| errorMessage.ejs
| navigation.ejs
|
-–users
index.ejs
settings.ejs
user.ejs

I have also tried absolute path (/model/user.js) and still didn’t work. I have tried the checking capitalization but that is not the case here. I am using MongoDB and have provided the environment variable for the connection to MongoDB (at first I missed this so I thought that might have been the problem but even when I included that, it still didn’t work). I also used the Google Recaptcha and have included both the Sitekey and Secretkey envVar but I doubt that is relevant. Anyways, any help is appreciated. And if there is something I forgot, please tell me and I will add the relevant information in.

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