简体   繁体   English

nodejs hello world示例 - 符号查找错误

[英]nodejs hello world example - symbol lookup error

UPDATE -- LINUX FEDORA 15 更新 - LINUX FEDORA 15

Following an example from: 以下示例:

http://simonwillison.net/2009/Nov/23/node/ http://simonwillison.net/2009/Nov/23/node/

My code: 我的代码:

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');

Produces the following error: 产生以下错误:

[abu@Beelzebub node_projects]$ nodejs helloworld.js
Server running at http://127.0.0.1:8080
nodejs: symbol lookup error: nodejs: undefined symbol: _ZN2v82V816IdleNotificationEv

To execute a node.js application, call it using node, not nodejs. 要执行node.js应用程序,请使用node而不是nodejs调用它。

node helloworld.js

The particular error seems similar to a V8 build mismatch problem that was in Node 0.6.15. 特定错误似乎类似于Node 0.6.15中的V8构建不匹配问题。 Have you tried using a newer (or rolling back to an older) version of Node? 您是否尝试过使用较新的(或回滚到旧版本)Node?

To perform node.js installation on Fedora Linux download and install the standalone rpm (http://nodejs.tchol.org/stable/f16/SRPMS/repoview/nodejs.html) and perform install as follows: 在Fedora Linux上执行node.js安装,请下载并安装独立的rpm(http://nodejs.tchol.org/stable/f16/SRPMS/repoview/nodejs.html)并按如下方式执行安装:

  1. Remove any existing node and nodejs applications using your package manager 使用包管理器删除任何现有节点和nodejs应用程序

  2. Install node.js from standalone rpm 从独立rpm安装node.js.

    rpm –ivh ./configure make make install rpm -ivh ./configure make make install

Attempting to use a package manager may lead to dependency issues as described on the following site: 尝试使用包管理器可能会导致依赖性问题,如以下站点所述:

http://nodejs.tchol.org/ http://nodejs.tchol.org/

this is 2009 tutorial and old api. 这是2009年教程和旧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 http://howtonode.org/hello-node

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM