Closed jescalan closed 8 years ago
You need to run it like this, as it is indeed disabled by default: _eval('module.exports = require("events")', true)
Ah thanks! Would help to have this in the docs :+1:
I'm trying this, but getting this error:
> const _eval = require('eval')
undefined
> _eval("import { _eval } from 'eval'", true)
Uncaught:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
at new NodeError (node:internal/errors:363:5)
at validateString (node:internal/validators:119:11)
at Object.dirname (node:path:1276:5)
at new Module (node:internal/modules/cjs/loader:170:20)
at requireLike (/Users/samueljoseph/Documents/Github/neurogrid/paironauts/node_modules/require-like/lib/require-like.js:5:22)
at module.exports (/Users/samueljoseph/Documents/Github/neurogrid/paironauts/node_modules/eval/eval.js:44:23)
at REPL8:1:1
at Script.runInThisContext (node:vm:129:12)
at REPLServer.defaultEval (node:repl:522:29)
at bound (node:domain:416:15) {
code: 'ERR_INVALID_ARG_TYPE'
}
on node v16.3.0, OSX 11.4
This seems like something aint right. Maybe it's because I'm running node v5 and it broke something?
It's showing the error
[ReferenceError: require is not defined]
for_eval
on any code that containsrequire
. Urgh.