Hi, I’m learning Node.js and Express using an online tutorial, during the tutorial I had to use the res.sendFile function, however when I ran my code I got an error saying “res.sendFile is not a function”, digging around for a bit I discovered that this is a problem with my version of Express, since the function “res.sendfile” works but “res.sendFile” doesn’t. So I uninstalled Express using npm and tried to reinstall it but no matter what I do it always installs version 3.21.2 instead of the newer 4.x version. Is there anything I’m missing or doing wrong here?
did you try
npm i express@4?
I hadn’t and it solved my problem! Thank you.