【问题标题】:Node.js Hello world script not workingNode.js Hello world 脚本不起作用
【发布时间】:2012-03-18 19:49:54
【问题描述】:

我刚刚从在线教程中获取了该代码:

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(3000, 'my.ip.is.here');
console.log('Server running at http://my.ip.is.here:3000/');

当我开始时:

node app.js

我收到以下错误:

events.js:48 抛出论据1; // 未处理的“错误”事件 ^ 错误:接受 ENOSYS 在 errnoException (net.js:614:11) 在 TCP.onconnection (net.js:788:24)

我在 ubuntu 11.10 服务器 VPS 上,我有 nginx 作为 Web 服务器,但它没有启动。

我做错了吗?

【问题讨论】:

  • ENOSYS 在系统不支持某个功能时发生。这可能与在 VPS 上有关 - 您是否在本地计算机上尝试过?
  • 解决了,感谢您的意见
  • 不用担心,很高兴你能成功。几天后,您将能够接受自己的答案

标签: node.js ubuntu nginx


【解决方案1】:

我的 node.js 版本来自我尝试使用 nodejs.org 的 git rep,现在它工作正常。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-07
    • 1970-01-01
    • 1970-01-01
    • 2017-09-15
    相关资源
    最近更新 更多