Can't install the newest version of node.js express


#1

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?


#2

did you try npm i express@4?


#3

I hadn’t and it solved my problem! Thank you.