santoshrajan / lispyscript

A javascript with Lispy syntax and macros
MIT License
572 stars 57 forks source link

ReferenceError: define is not defined #35

Closed leizongmin closed 11 years ago

leizongmin commented 11 years ago

I try to require the "lispyscript" module, it throws an error:

> require('lispyscript')
ReferenceError: define is not defined
    at Object.<anonymous> (/home/me/myapp/node_modules/lispyscript/lib/ls.js:8:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at repl:1:2
    at REPLServer.self.eval (repl.js:110:21)
    at Interface.<anonymous> (repl.js:239:12)
santoshrajan commented 11 years ago

You cannot 'require' lispyscript like that. You have to run it from the command line. see docs.

leizongmin commented 11 years ago

I want to use lispyscript like this without compile command:

require('./mycode.ls');

Now the problem has been solved:

var path = require('path');
require(path.resolve(path.dirname(require.resolve('lispyscript')), 'node.js'));
require('lispyscript');