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

假如想象 提交于 2019-12-01 15:08:10

问题


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.


回答1:


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

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




回答2:


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

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



来源:https://stackoverflow.com/questions/8404562/node-js-require-is-not-defined-exception

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!