Failed node js deloymentr

Hello Dev Community,
I just finished deploying my node.js site on render and its giving me the following error :

[nodemon] 2.0.20
Dec 20 03:43:49 PM [nodemon] to restart at any time, enter rs
Dec 20 03:43:49 PM [nodemon] watching path(s): .
Dec 20 03:43:49 PM [nodemon] watching extensions: js,mjs,json
Dec 20 03:43:49 PM [nodemon] starting node index.js
Dec 20 03:43:59 PM internal/modules/cjs/loader.js:888
Dec 20 03:43:59 PM throw err;
Dec 20 03:43:59 PM ^
Dec 20 03:43:59 PM
Dec 20 03:43:59 PM Error: Cannot find module ‘…/server/models/WorkoutModel.js’
Dec 20 03:43:59 PM Require stack:
Dec 20 03:43:59 PM - /opt/render/project/src/index.js
Dec 20 03:43:59 PM at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
Dec 20 03:43:59 PM at Function.Module._load (internal/modules/cjs/loader.js:730:27)
Dec 20 03:43:59 PM at Module.require (internal/modules/cjs/loader.js:957:19)
Dec 20 03:43:59 PM at require (internal/modules/cjs/helpers.js:88:18)
Dec 20 03:43:59 PM at Object. (/opt/render/project/src/index.js:15:17)
Dec 20 03:43:59 PM at Module._compile (internal/modules/cjs/loader.js:1068:30)
Dec 20 03:43:59 PM at Object.Module._extensions…js (internal/modules/cjs/loader.js:1097:10)
Dec 20 03:43:59 PM at Module.load (internal/modules/cjs/loader.js:933:32)
Dec 20 03:43:59 PM at Function.Module._load (internal/modules/cjs/loader.js:774:14)
Dec 20 03:43:59 PM at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) {
Dec 20 03:43:59 PM code: ‘MODULE_NOT_FOUND’,
Dec 20 03:43:59 PM requireStack: [ ‘/opt/render/project/src/index.js’ ]
Dec 20 03:43:59 PM }
Dec 20 03:43:59 PM [nodemon] app crashed - waiting for file changes before starting…

A good help will be highly appreciated
Thanks
Kelvin

Hi there

Have you checked the casing? If you go into your repo check if there there a file under server/models called WorkoutModel.js - not workoutmodel.js or Workoutmodel.js

The error is telling you that it can’t find the file so check if the folders and the file is correct, both the location and the uppper/lowercasing.

1 Like

Sorry, sir, it’s finally developed successfully.
I made a mistake requiring my model on the index file.
Many thanks again.

Hi again

Good to hear everything is working.

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