res.sendFile is not a function Node.js

This specific issue has already been answered, but it's worth mentioning that if you're using "express" version 3.x, the fix could be as easy as switching res.sendFile('path-to-file'); to res.sendfile('path-to-file');

This was the problem in my case. So you can either upgrade the express version (or) change the method name with lower case to fix this issue.


sendFile only in Express module.

Try this code

 var express = require('express');
 var app = express();
 app.get('/', function(req, res) {
     res.sendFile('path-to-file');
 });
 app.listen(PORT);