Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

ReferenceError: generate is not defined #19

Closed
fgnass opened this issue Mar 12, 2016 · 3 comments
Closed

ReferenceError: generate is not defined #19

fgnass opened this issue Mar 12, 2016 · 3 comments

Comments

@fgnass
Copy link
Collaborator

fgnass commented Mar 12, 2016

Hi Jed,

I get the following error and honestly don't understand what's going on here and why the tests pass. I'm obviously missing something here:

ReferenceError: generate is not defined
    at lave (/Users/flx/Projects/forks/lave/index.js:65:14)

Shouldn't https://github.com/jed/lave/blob/master/lave.js#L65 use options.generate instead of just generate?

@jamen
Copy link

jamen commented Mar 12, 2016

The name options seems kind of misleading. In this case options.generate isn't even really an option (is it?), it's a function to do things.

@fgnass
Copy link
Collaborator Author

fgnass commented Mar 12, 2016

@jamen well, passing that function is indeed optional so I think the naming makes sense. On the other hand I'd really appreciate if lave() would return a string by default and obtaining the AST would be optional instead. @jed: Would you consider adding escodegen as dependency? (I'm aware that one could in theory use any Mozilla AST compatible formatter, I'm just wondering if this is even a real use case.)

@jed jed closed this as completed in 6d2a13a Mar 13, 2016
jed added a commit that referenced this issue Mar 13, 2016
use generate function from options (fixes #19)
@matheusnas
Copy link

Hey, guys!

Could you help me solve this problem please? I need to run a file javaScript codes on the node. But I can not do that. When I run, this message appears:

var newCode = escodegen.generate(contents);
ReferenceError: escodegen is not defined
at repl:1:15
at sigintHandlersWrap (vm.js:22:35)
at sigintHandlersWrap (vm.js:73:12)
at ContextifyScript.Script.runInThisContext (vm.js:21:12)
at REPLServer.defaultEval (repl.js:340:29)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer. (repl.js:539:10)
at emitOne (events.js:101:20)
at REPLServer.emit (events.js:188:7)

Before I run, I installed esprima and escodegen on node.

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

No branches or pull requests

3 participants