I've just installed Node JS (v0.10.0) on a netbook running Linux Peppermint Three. I have a file to run which has the following at the top:
var app = require('express').createServer(),
io = require('socket.io').listen(app);
app.listen(8080);
// routing
app.get('/', function (req, res) {
res.sendfile(__dirname + '/index.html');
});
The problem is that when I visit localhost:8080
I get the following:
TypeError: Arguments to path.join must be strings
at path.js:360:15
at Array.filter (native)
at exports.join (path.js:358:36)
at exports.send (/home/guy/Dropbox/Node/socket_io echo test/node_modules/express/node_modules/connect/lib/middleware/static.js:129:20)
at ServerResponse.res.sendfile (/home/guy/Dropbox/Node/socket_io echo test/node_modules/express/lib/response.js:186:3)
at usernames (/home/guy/Dropbox/Node/socket_io echo test/med.js:11:7)
at callbacks (/home/guy/Dropbox/Node/socket_io echo test/node_modules/express/lib/router/index.js:272:11)
at param (/home/guy/Dropbox/Node/socket_io echo test/node_modules/express/lib/router/index.js:246:11)
at pass (/home/guy/Dropbox/Node/socket_io echo test/node_modules/express/lib/router/index.js:253:5)
at Router._dispatch (/home/guy/Dropbox/Node/socket_io echo test/node_modules/express/lib/router/index.js:280:5)
The exact same file works on my Windows XP laptop but I haven't updated Node there yet (still running v0.8.15). So I don't know if it's my installation of Node on Linux (to which I'm new) that's the problem or the disparity between versions. Obviously I don't want to update Node on Windows if it's going to result in the same problem.
I've checked that Express is where it should be and that seems okay. I've tried re-installing it via npm. I've looked up the error (by searching for the first line above) and found mentions here and here and here, where all seem to be saying it's resolved.
Any ideas what else (if anything) I can try to get my simple page server working?