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

repl require() broken in iojs 2.x #1633

Closed
isaacs opened this issue May 5, 2015 · 6 comments
Closed

repl require() broken in iojs 2.x #1633

isaacs opened this issue May 5, 2015 · 6 comments

Comments

@isaacs
Copy link
Contributor

isaacs commented May 5, 2015

No longer acts as if it's a module in cwd. This is really annoying.

$ npm ls ini
[email protected] /Users/isaacs/dev/npm/npmconf
├─┬ [email protected]
│ └── [email protected]
└── [email protected]


$ node -p "require('ini')"
{ decode: [Function: decode],
  parse: [Function: decode],
  encode: [Function: encode],
  stringify: [Function: encode],
  safe: [Function: safe],
  unsafe: [Function: unsafe] }

$ node
> process.version
'v2.0.0'
> require("ini")
Error: Cannot find module 'ini'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at repl:1:1
    at REPLServer.defaultEval (repl.js:141:27)
    at bound (domain.js:254:14)
    at REPLServer.runBound [as eval] (domain.js:267:12)
    at REPLServer.<anonymous> (repl.js:295:12)
    at emitOne (events.js:77:13)
>

# expected behavior:
$ nave use 1.8.1
Already installed: 1.8.1
using 1.8.1

$ node
> process.version
'v1.8.1'
> require('ini')
{ decode: [Function: decode],
  parse: [Function: decode],
  encode: [Function: encode],
  stringify: [Function: encode],
  safe: [Function: safe],
  unsafe: [Function: unsafe] }

Probably one of the recent changes to lib/repl.js or lib/module.js.

@isaacs
Copy link
Contributor Author

isaacs commented May 5, 2015

Nevermind, fixed in 2.0.1 apparently. Thanks.

@isaacs isaacs closed this as completed May 5, 2015
@Fishrock123
Copy link
Contributor

Shouldn't this be fixed in the release version of 2.0.0?

@Fishrock123
Copy link
Contributor

I.e. fixes were in #605

@chrisdickinson
Copy link
Contributor

Hm? I'm on v2.0.0 and it seems okay – fixes were in #1605, as @Fishrock123 notes.

@mcheshkov
Copy link

I hit this with 5.2.0 from nodesource on kubuntu 15.10

$ npm ls
/home/cheshkov/repl
└── [email protected]

$ node -p "require('ini')"
{ decode: [Function: decode],
  parse: [Function: decode],
  encode: [Function: encode],
  stringify: [Function: encode],
  safe: [Function: safe],
  unsafe: [Function: unsafe] }
$ node
> process.version
'v5.2.0'
> require('ini')
Error: Cannot find module 'ini'
    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:1
    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)
>

UPD
4.2.3 works fine

@evanlucas
Copy link
Contributor

@mcheshkov The 5.2.0 issue was a different one. It has been fixed in v5.3.0 (https://nodejs.org/en/blog/release/v5.3.0/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants