zoukankan      html  css  js  c++  java
  • node.js创建服务器报错

    创建nodeTest.js如下:

    1 var http = require('http');
    2 http.createServer(function (request, response){
    3     response.writeHead(200, {'Content-Type' : 'text/plain'});
    4     response.end('hello world
    ');
    5 }).listen(80);
    6 
    7 console.log('server running at http://127.0.0.1:80');

    在终端中输入 node nodeTest.js 始终报错:

    错误原因:

    已经运行的另一个服务器使用了相同的端口,换一个端口就可以了。

    如把80换成8080,再次运行:

  • 相关阅读:
    FormData的使用
    数据绑定
    DOM的映射机制
    leetcode750
    leetcode135
    leetcode41
    leetcode269
    leetcode253
    leetcode42
    leetcode48
  • 原文地址:https://www.cnblogs.com/wx1993/p/5086984.html
Copyright © 2011-2022 走看看