Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Conversation

@koichik
Copy link

@koichik koichik commented Jun 17, 2011

With -e or --eval, require() can load module using relative path.

node -e 'require("./foo")'

But it can't load module from node_modules directory.
Reproduce:

$ node -e 'require("foo")'

module.js:322
    throw new Error("Cannot find module '" + request + "'");
          ^
Error: Cannot find module 'foo'
    at Function._resolveFilename (module.js:322:11)
    at Function._load (module.js:267:25)
    at require (module.js:351:19)
    at Object.<anonymous> (eval at <anonymous> (eval:1:82))
    at Object.<anonymous> (eval:1:70)
    at Module._compile (module.js:407:26)
    at Function.runEval (node.js:357:27)
    at startup (node.js:57:17)
    at node.js:443:3

With -e or --eval, require() can load module using relative path.

    node -e 'require("./foo")'

But it can't load module from node_modules directory.

    node -e 'require("foo")'
@ry
Copy link

ry commented Jun 20, 2011

lgtm. thanks koichi

@ry ry closed this in d6ec8f6 Jun 20, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants