Hi,
I’m trying to deploy my project but facing errors, these are the errors:
throw err;
Error: Cannot find module ‘…/models/User.js’
’
I checked that ‘…/models/User.js’ is the correct route and that it’s User.js and not user.js both in github and locally. and it its.
I would love some help.
complete log:
Apr 26 12:40:41 AM> expresstracker-backend@1.0.0 start
Apr 26 12:40:41 AM> npm install && node app.js
Apr 26 12:40:41 AM
Apr 26 12:40:47 AM
Apr 26 12:40:47 AMup to date, audited 161 packages in 4s
Apr 26 12:40:47 AM
Apr 26 12:40:47 AM17 packages are looking for funding
Apr 26 12:40:47 AM run npm fund
for details
Apr 26 12:40:47 AM
Apr 26 12:40:47 AMfound 0 vulnerabilities
Apr 26 12:40:49 AMnode:internal/modules/cjs/loader:1146
Apr 26 12:40:49 AM throw err;
Apr 26 12:40:49 AM ^
Apr 26 12:40:49 AM
Apr 26 12:40:49 AMError: Cannot find module ‘…/models/User.js’
Apr 26 12:40:49 AMRequire stack:
Apr 26 12:40:49 AM- /opt/render/project/src/controllers/user.js
Apr 26 12:40:49 AM- /opt/render/project/src/routes/users.js
Apr 26 12:40:49 AM- /opt/render/project/src/app.js
Apr 26 12:40:49 AM at Module._resolveFilename (node:internal/modules/cjs/loader:1143:15)
Apr 26 12:40:49 AM at Module._load (node:internal/modules/cjs/loader:984:27)
Apr 26 12:40:49 AM at Module.require (node:internal/modules/cjs/loader:1231:19)
Apr 26 12:40:49 AM at require (node:internal/modules/helpers:179:18)
Apr 26 12:40:49 AM at Object. (/opt/render/project/src/controllers/user.js:1:14)
Apr 26 12:40:49 AM at Module._compile (node:internal/modules/cjs/loader:1369:14)
Apr 26 12:40:49 AM at Module._extensions…js (node:internal/modules/cjs/loader:1427:10)
Apr 26 12:40:49 AM at Module.load (node:internal/modules/cjs/loader:1206:32)
Apr 26 12:40:49 AM at Module._load (node:internal/modules/cjs/loader:1022:12)
Apr 26 12:40:49 AM at Module.require (node:internal/modules/cjs/loader:1231:19) {
Apr 26 12:40:49 AM code: ‘MODULE_NOT_FOUND’,
Apr 26 12:40:49 AM requireStack: [
Apr 26 12:40:49 AM ‘/opt/render/project/src/controllers/user.js’,
Apr 26 12:40:49 AM ‘/opt/render/project/src/routes/users.js’,
Apr 26 12:40:49 AM ‘/opt/render/project/src/app.js’
Apr 26 12:40:49 AM ]
Apr 26 12:40:49 AM}
Apr 26 12:40:49 AM
Apr 26 12:40:49 AMNode.js v20.12.2