Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: require is not defined #7

Open
yocontra opened this issue Apr 24, 2012 · 0 comments
Open

ReferenceError: require is not defined #7

yocontra opened this issue Apr 24, 2012 · 0 comments

Comments

@yocontra
Copy link

var obj = {
  fn: function(url, cb) {
    require('http').get({
      host: url
    }, cb);
  }
};
var str = JASON.stringify(obj);
console.log(str);
var newobj = JASON.parse(str);

yields

{"fn":(function (url, cb) {
          require('http').get({
            host: url
          }, cb);
        })}

undefined:2
          require('http').get({
          ^
ReferenceError: require is not defined
    at eval at parse (/home/codex/apps/thread/node_modules/JASON/index.js:276:12)

I read the README section about this and it says items in the global scope (like require) should work. Am I doing something wrong here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@yocontra and others