Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js - require is not defined exception [closed]

I am a complete Node.js newbie and struggling with the basics. Running this code on the server:

var http        = require("http"),
    sys         = require("util"),
    io          = require("socket.io"),
    GlobTrie    = require("glob-trie.js");

Gives me an exception at the first require:

Uncaught ReferenceError: require is not defined
(anonymous function)

Any thoughts?

Best regards, Ben.

like image 896
Ben Avatar asked Dec 06 '11 18:12

Ben


2 Answers

Node.js is run on the server side, not on the browser side.

Check out more about Node here: What is Node.js?

like image 133
alessioalex Avatar answered Sep 21 '22 17:09

alessioalex


Case closed, I was including the wrong file on the client!

Sorry to waste people time, but thanks for the Node links.

like image 28
Ben Avatar answered Sep 19 '22 17:09

Ben