I’m new to deploying web services on Render and i’m trying to deploy the backend part of my monorepo as a web service. The backend is Node Express, and it seems to build successfully, but then the project won’t start, and throws the error:
Error: Cannot find module ‘/opt/render/project/src/backend/server.js’
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
at Function.Module._load (internal/modules/cjs/loader.js:730:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) at internal/main/run_main_module.js:17:47 { code: ‘MODULE_NOT_FOUND’,
requireStack:
I’m confused about the path in the error, and this may be a stupid question, but what is the src in the "‘/opt/render/project/src/backend/server.js’, is it just something Render inserts for all paths, or do i need to add one in?
I’ve tried all sorts of root directory paths: ./backend, ./backend/server
It doesn’t seem to match the one in my filesystem (see picture). My frontend static site deployed just fine.