我正在使用Eclipse 的nodeeclipse插件来运行我的节点 js 项目。以下 js 文件工作正常,但h1标记不工作。我只能看到纯文本。加上我在运行时遇到此异常。请帮助我出去。
文件
var http = require('http');
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/html'});
response.end('<html><body><h1>Home</h1> URL was: ' + request.url + '</body></html>');
}).listen(3000, 'localhost');
console.log('Server running at http://localhost:3000/');
例外
events.js:72
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at errnoException (net.js:904:11)
at Server._listen2 (net.js:1042:14)
at listen (net.js:1064:10)
at net.js:1146:9
at dns.js:72:18
at process._tickCallback (node.js:415:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:902:3