Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can no longer require local modules in REPL in 5.2.0 #4228

Closed
Macil opened this issue Dec 10, 2015 · 1 comment
Closed

Can no longer require local modules in REPL in 5.2.0 #4228

Macil opened this issue Dec 10, 2015 · 1 comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs.

Comments

@Macil
Copy link

Macil commented Dec 10, 2015

I'm used to being able to cd into a project directory, start a REPL, and require modules that are installed in the node_modules directory. It works in 5.1.1 and previous versions of node I've used, but it stopped working in 5.2.0.

chris@Truth:/tmp$ mkdir foo
chris@Truth:/tmp$ cd foo
chris@Truth:/tmp/foo$ npm i lodash
/tmp/foo
└── lodash@3.10.1 

npm WARN enoent ENOENT: no such file or directory, open '/tmp/foo/package.json'
npm WARN foo No description
npm WARN foo No repository field.
npm WARN foo No README data
npm WARN foo No license field.
chris@Truth:/tmp/foo$ ls node_modules/
lodash
chris@Truth:/tmp/foo$ uname -a
Linux Truth 4.2.0-19-generic #23-Ubuntu SMP Wed Nov 11 11:39:30 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
chris@Truth:/tmp/foo$ node -v
v5.2.0
chris@Truth:/tmp/foo$ npm -v
3.5.1
chris@Truth:/tmp/foo$ NODE_DEBUG=module node
> var l = require('lodash');
MODULE 13279: Module._load REQUEST lodash parent: <repl>
MODULE 13279: looking for "lodash" in ["/home/chris/.node_modules","/home/chris/.node_libraries","/usr/local/lib/node"]
Error: Cannot find module 'lodash'
    at Function.Module._resolveFilename (module.js:327:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:355:17)
    at require (internal/module.js:13:17)
    at repl:1:9
    at REPLServer.defaultEval (repl.js:252:27)
    at bound (domain.js:281:14)
    at REPLServer.runBound [as eval] (domain.js:294:12)
    at REPLServer.<anonymous> (repl.js:417:12)
    at emitOne (events.js:83:20)

And then here's it working in 5.1.1:

chris@Truth:/tmp/foo$ NODE_DEBUG=module ~/Programs/node-v5.1.1-linux-x64/bin/node 
MODULE 13416: Module._load REQUEST internal/repl parent: undefined
MODULE 13416: Module._load REQUEST readline parent: internal/repl
MODULE 13416: load native module readline
MODULE 13416: Module._load REQUEST repl parent: internal/repl
MODULE 13416: Module._load REQUEST util parent: repl
MODULE 13416: load native module util
MODULE 13416: Module._load REQUEST stream parent: repl
MODULE 13416: load native module stream
MODULE 13416: Module._load REQUEST vm parent: repl
MODULE 13416: load native module vm
MODULE 13416: Module._load REQUEST path parent: repl
MODULE 13416: load native module path
MODULE 13416: Module._load REQUEST fs parent: repl
MODULE 13416: load native module fs
MODULE 13416: Module._load REQUEST readline parent: repl
MODULE 13416: load native module readline
MODULE 13416: Module._load REQUEST console parent: repl
MODULE 13416: load native module console
MODULE 13416: Module._load REQUEST domain parent: repl
MODULE 13416: load native module domain
MODULE 13416: Module._load REQUEST module parent: repl
MODULE 13416: load native module module
MODULE 13416: Module._load REQUEST path parent: internal/repl
MODULE 13416: load native module path
MODULE 13416: Module._load REQUEST fs parent: internal/repl
MODULE 13416: load native module fs
MODULE 13416: Module._load REQUEST os parent: internal/repl
MODULE 13416: load native module os
MODULE 13416: Module._load REQUEST util parent: internal/repl
MODULE 13416: load native module util
> require('lodash')
MODULE 13416: Module._load REQUEST lodash parent: repl
MODULE 13416: looking for "lodash" in ["/tmp/foo/repl/node_modules","/tmp/foo/node_modules","/tmp/node_modules","/node_modules","/home/chris/.node_modules","/home/chris/.node_libraries","/home/chris/Programs/node-v5.1.1-linux-x64/lib/node"]
MODULE 13416: load "/tmp/foo/node_modules/lodash/index.js" for module "/tmp/foo/node_modules/lodash/index.js"
{ [Function: lodash]
...
@Macil
Copy link
Author

Macil commented Dec 10, 2015

Oh, duplicate of #4208. (I only searched the open issues!)

@Macil Macil closed this as completed Dec 10, 2015
@ChALkeR ChALkeR added the duplicate Issues and PRs that are duplicates of other issues or PRs. label Dec 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs.
Projects
None yet
Development

No branches or pull requests

2 participants