我在一个名为server.js的文件中有以下代码。运行node.js代码只显示一个节点标识符
var http = require('http');
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World\n');
}).listen(8124);
console.log('Server running at http://127.0.0.1:8124/');
我使用命令提示符和naviage文件夹所在的文件recides,然后运行命令
node server.js
但我没有得到预期的输出。相反,我得到
The node identifier for {My Machine Name} is v2hrfnqaj.
注:我已经有节点安装在我的机器,它工作正常。
当你'节点-v'会发生什么? – Trevor 2013-02-14 19:22:57
当你进入'http://127.0.0.1:8124 /'时会发生什么? – 2013-02-14 19:24:12
@Trevor:节点-v无法正常工作..我获得相同的输出 – Muthukumar 2013-02-14 19:48:17