I tried to run a sample server but I got error message on Windows. Then I tried to run it on my friend's machine, but it just went well, windows system too. I don't know what's happening. Let me show the source code and the error message: source code:
var http = require("http");
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(8888);
output:
D:\test>node server.js
module.js:340
throw err;
^
Error: Cannot find module 'D:\test\server.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
Ps: server.js is the file to execute.
The error you are mentioning is appearing because, you are trying to execute a file that is not there.
Check if your D:\test folder has a file named server.js with the code you have quoted above.
I suggest you to check whether server.js is in your current folder from the console by typing dir command, before you go for node server.js