No opportunity to set relative path to build folder on web service

Hey guys,

It’s the first time I try to use on render to deploy my react application. Set up the env, GitHub connection, build and start script, but after deploying the application, I only get 404 when accessing my page.
Everything seems to be fine, redirection logics does work (server is running), but on render tries to find the build folder inside the src folder.
When trying to set up a static page, I can choose a relative path for the build folder. Is there anything similar for the web service?
If not, how can I solve that issue? I actually do not want to have my build/dist folder inside the src folder.

Oct 4 04:41:59 PM  Error: ENOENT: no such file or directory, stat '/opt/render/project/src/dist/index.html'
  app.use('/', (req, res) => {
    return res.sendFile(path.resolve(__dirname, '../../dist', 'index.html'));
"start": "rm -rf ./node_modules/.cache/@babel && BASE_URL='' node ./src/server/index.js"

That previously worked with heroku and still works on my local machine.

Many thanks in advance!

Hi there,

The src/ directory is part of the Render backend for web services, there isn’t an option to create a specific publish directory for web services like there is for static sites because there aren’t any statically built assets. I am curious why you want to move the /dist folder?

Ah okay, so I should choose the static page right? By now I only got a node server delivering my client assets. Well, actually all my assets / index.html are copied to a dist(build) folder. That folder is located on root level, not inside my src folder. But according to your reply, that should not cause my issue right? If I understand it correctly, the destination of my “native” src folder would be:


Right? I am confused :smiley:

Edit: No, I guess that assumption is not correct.
I would love to have features like PR reviews, which are only available on web services.

Edit2: My assumption is correct, so far so good. Upgraded to starter, used the shell to take a look at the projects structure. My build (dist) folder is missing.

Edit3: Sorry, I’m stupid. npm does not have an alias for “build”, so using “npm run build” instead of “npm build” does the trick :frowning:

But Tyler, thanks for your input, more or less, it led me to the right direction :slight_smile:

Hi there,

I’m afraid we may be talking past each other. Do you mind sending a link to the service that is having issues to I would be happy to take a closer look.

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