node-eval icon indicating copy to clipboard operation
node-eval copied to clipboard

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

Open tansaku opened this issue 3 years ago • 0 comments

❯ 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:

  • https://github.com/pierrec/node-eval/issues/11
  • https://github.com/pierrec/node-eval/issues/12

but not sure what to try next ...

tansaku avatar Jul 19 '21 11:07 tansaku