I am getting a status 1 error when trying to deploy my backend code


I am getting the following message when trying to deploy my backend code from node:

(I’m not sure if the error code is visible, so I’ve pasted it here):

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

My server.js file isn’t in an src folder, but I’ve not indicated that it was in the form. Could this be the problem, and if so, is there a way around it?

Here is a link to my repository if that helps: GitHub - souste/Project-1-Social-Site-2023---Back-End: First solo project of 2023 - Learning the ropes

Help would be appreciated.




The path before your server.js file is the default root path Render is using to deploy your project on its server, so a file inside an “src” folder would be located in “project/src/src”.

I see that you have quite a lot of similar services in your account, which one are you having issue with? Bear in mind that re-creating a service is generally not the way to go, especially for this kind of code error.

Is server.js located at the root of your project?

Jérémy, Render Support

Hi Jeremy,

Thanks for getting back to me.

Sorry, I didn’t know how to edit or delete a previously attempted service, so kept creating new ones (if there is a way to do this can you let me know?). They are all trying the same thing with a couple of minor tweaks…

Yes, server.js is the main file that I run that I run in node to get the server started. Thanks.



To trigger a new deploy, you can just either push some new code to your repo, trigger a deploy manually via the “Manual Deploy” button or update a service’s setting.

The issue here is that you have not set the correct root directory of your project. Render is looking at your repo’s root by default and will only see the folder “Project_one_social” and a README.md, no package.json or server.js files.

Go to your service’s settings tab, find the root directory input and change it to “Project_one_social”.

Jérémy, Render Support

Hi Jeremy,

Thanks for much for this, it works now :slight_smile:



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