Ask coding questions

← Back to all posts
Help with res.sendFile()
SamuelWaller1 (0)

When I send the form submission, it gives this error:
TypeError: path must be absolute or specify root to res.sendFile

I looked it up and things said to put in __dirname, but that didn't work. What confuses me is that the example code does the exact same thing, and it works fine. I have no clue what's wrong.

Thanks!

Answered by Vandesm14 (685) [earned 5 cycles]
View Answer
Commentshotnewtop
Vandesm14 (685)

It's giving me an error

You cannot have numbers in variable names. (not in the first character)

SamuelWaller1 (0)

@Vandesm14 I fixed it, and it still gives the same error.

Vandesm14 (685)

@Vandesm14 Wait, I see now. It's for the /bacc3 route that it's broken.
I cannot seem to get it to work. I will get back to you if I figure it out.

Vandesm14 (685)

@SamuelWaller1 Update: It's happened to me as well. Hopefully the team gets on this urgently because I can't work on my project due to this bug. I have posted this to the bugs board. Please upvote it here: https://repl.it/bugs/p/expressjs-path-must-be-absolute-bug