Search code examples
deploymenthostingrender.com

Using Render hosting app to deploy my project- Error Cannot find module


Follows Heroku becoming a paid app, I am trying other options. Does anyone have experience uploading a MongoDB server-based project to "Render" Application Hosting?

This is the repo I want to deploy: https://github.com/myyoss/FUNDLE_A_WORDLE_CLONE

On the app settings I use for the Build Command: "yarn" (and it seems to works cause I get "Build successful" message).

But for the Start Command I can't get the correct command/path. I keep getting this error:

==> Build successful :

Oct 7 06:41:33 PM ==> Deploying…

Oct 7 06:42:01 PM ==> Starting service with ‘node dist/server.js’

Oct 7 06:42:06 PM internal/modules/cjs/loader.js:888

Oct 7 06:42:06 PM throw err;

Oct 7 06:42:06 PM ^

Oct 7 06:42:06 PM

Oct 7 06:42:06 PM Error: Cannot find module ‘…/routes/userRoutes’

Can someone please take a look at the repo LINK and tell me what I'm doing wrong?

On an other project I used "node dist/server.js" for the Start Command and it worked just fine.


Solution

  • After weeks of searching for a solution to the problem, I found it! As silly as it sounds I'll write it here, maybe it will save one of you guys wasting a lot of precious time. The problem was that the build folder was not updated, and all the changes and corrections I made actually remained as they are in production. After deleting the build folder and created it again the problem was solved :)