小编use*_*153的帖子

node.js代码示例教程失败,错误:listen EADDRINUSE

我是一名初学程序员,正在尝试使用以下教程网站http://www.nodebeginner.org/#hello-world学习node.js

我到了试图设置服务器的地步,但是下面的代码出错了

var http = require("http");

http.createServer(function(request, response) {
  response.writeHead(200, {"Content-Type": "text/plain"});
  response.write("Hello World");
  response.end();
}).listen(8888);
Run Code Online (Sandbox Code Playgroud)

错误:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: listen EADDRINUSE
    at errnoException (net.js:884:11)
    at Server._listen2 (net.js:1022:14)
    at listen (net.js:1044:10)
    at Server.listen (net.js:1110:5)
    at Object.<anonymous> (/Users/.........../server.js:7:4)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
Run Code Online (Sandbox Code Playgroud)

任何帮助,将不胜感激

node.js

3
推荐指数
1
解决办法
9142
查看次数

标签 统计

node.js ×1