pierrec / node-eval

Evaluate node require() module content directly
MIT License
93 stars 20 forks source link

trying to use require "path" error: The "path" argument must be of type string #26

Open tansaku opened 3 years ago

tansaku commented 3 years ago
❯ node --experimental-modules
Welcome to Node.js v16.3.0.
Type ".help" for more information.
> const _eval = require('eval', '.', {}, true)
undefined
> _eval("var expect = require('chai').expect", 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 REPL2: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'
}

any ideas?

I looked at the following issues:

but not sure what to try next ...