在我的浏览器中获取服务器禁止错误

Jam*_*mes 4 node.js

我刚开始探索node.js. 在我的Windows服务器上安装了msi文件.我的代码在命令窗口中返回我预期的输出

var http = require("http");

http.createServer(function (request, response) {

// Send the HTTP header 
// HTTP Status: 200 : OK
// Content Type: text/plain
response.writeHead(200, {'Content-Type': 'text/plain'});

// Send the response body as "Hello World"
response.end('Hello World\n');
}).listen(8081);

// Console will print the message
console.log('Server running at `http://127.0.0.1:8081/`');
Run Code Online (Sandbox Code Playgroud)

但是当我输入http://127.0.0.1:8081/我的浏览器时 ,我得不到任何输出.当我看到控制台我得到低于错误

Failed to load resource: the server responded with a status of 403 (Forbidden)
Run Code Online (Sandbox Code Playgroud)

我错了怎么解决?我正在关注此链接

mid*_*ido 15

可能就像我目前的PC一样,你也必须运行迈克菲或其他一些程序已经在使用端口8081,你有两个选择:

  • 停止McAfee或该端口上运行的其他程序
  • 侦听节点服务器上的其他端口