Nodejs hello world example - symbol search error

UPDATE - LINUX FEDORA 15

Following an example from:

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

My code is:

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

It 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
+3
source share
3 answers

This is a 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 out of date :) switch to this →

http://howtonode.org/hello-node

0
source

To run the node.js application, call it using node, not nodejs.

node helloworld.js

The specific error seems similar to the V8 build mismatch problem that was in Node 0.6.15. Have you tried using a newer version (or rollback to an older one) of Node?

0
source

node.js Fedora Linux, rpm (http://nodejs.tchol.org/stable/f16/SRPMS/repoview/nodejs.html) :

  • node nodejs,

  • Install node.js from standalone revs

    rpm -ivh. / configure do make install

Attempting to use the package manager can lead to dependency problems, as described on the following site:

http://nodejs.tchol.org/

0
source

All Articles