'Cannot find module' error but path seems correct!? 🤔

Hi there :wave:t2:

I’m trying to deploy my the backend of my app for the first time using Render. I’ve followed the steps but am getting the following error:

Which is confusing for me as I have already specified ‘Backend’ as my root directory and Server.js sits directly within the Backend directory.

The project runs perfectly when I run it locally, using ‘node Server.js’ from Backend to get it up and running.

Any ideas would be really appreciated! Please let me know if you need any more info.

1 Like

Well i was getting the same error when i was tying to deploy my backend as well but what worked for me is i changed my build command to :- npm install; npm run build

i really hope this also work for u :v::raised_hands:

Hey @ aayushsingh7

Thanks for commenting! Forgive my ignorance, do you mean updating like this in the package.json file:

and then accordingly in the Render setup?

I have just tried this and I seem to be stuck in a deploy infinite loop so think I didn’t understand you correctly :sweat_smile::woman_facepalming:t3:

Well no problem, i was taking about the build command here :-

and please make sure to correct your package.json build command as it was before because “npm install; npm run build” will result in infinite loop as u mentioned

i really hope this should fix the problem if not then we could connect on instagram as its really not convenient to discuss here🙌

The problem is solved! Weirdly, I just kept running it, with your idea and then back to my original and now it’s working and connected - thanks so much for your help and have a great day :blush:

Nice​:raised_hands::sparkles:

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