nodejs hello world示例 - 符号查找错误 [英] nodejs hello world example - symbol lookup error
本文介绍了nodejs hello world示例 - 符号查找错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
更新 - LINUX FEDORA 15
以下示例:
http://simonwillison.net/2009/Nov/23/node/
我的代码:
var util = require('util'),
http = require('http');
http.createServer(function(req, res) {
res.sendHeader(200, {'Content-Type': 'text/html' });
res.sendBody('<h1>Hello World</h1>');
res.finish();
}).listen(8080);
util.puts('Server running at http://127.0.0.1:8080');
产生以下错误:
[abu@Beelzebub node_projects]$ nodejs helloworld.js
Server running at http://127.0.0.1:8080
nodejs: symbol lookup error: nodejs: undefined symbol: _ZN2v82V816IdleNotificationEv
推荐答案
这是2009年教程和旧api。你应该这样做
this is 2009 tutorial and old api. You should do it like this
var http = require('http');
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World\n");
});
server.listen(8000);
console.log("Server running at http://127.0.0.1:8000/");
你的教程很旧:)切换到这个 - >
Your tutorial is old :) switch to this ->
http://howtonode.org/hello-node
这篇关于nodejs hello world示例 - 符号查找错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文