简体   繁体   中英

nodejs hello world example - symbol lookup error

UPDATE -- LINUX FEDORA 15

Following an example from:

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 helloworld.js

The particular error seems similar to a V8 build mismatch problem that was in Node 0.6.15. Have you tried using a newer (or rolling back to an older) version of 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:

  1. Remove any existing node and nodejs applications using your package manager

  2. Install node.js from standalone rpm

    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/

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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