Error: ENOENT: no such file or directory, stat '/client/index.html'

Hi, when using .sendFile() it seems like I cannot serve static HTML above the current folder(above __dirname folder). I have looked at some issues with similar error but I still cannot figure out why? please advice.

Here is a link to the app: https://glitch.com/edit/#!/productivity-tracker

your not serving the HTML file. see
this could be done manually with

route.get("/", function(request, response) {
  response.sendFile(__dirname + "/client/index.html");
});

Hi @datduyng, welcome to the Glitch forum!

Another option would be to modify https://glitch.com/edit/#!/productivity-tracker?path=server.js:20:32 to serve the client directory statically, instead.

1 Like